From f7546f14ea529cf5c2cf00d419df367b165ef1e8 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Sat, 25 Sep 2021 11:40:50 +0300 Subject: [PATCH] test: fix snapshots --- .../coverageProviderV8.test.ts.snap | 9 +++++ .../__snapshots__/v8Coverage.test.ts.snap | 25 ------------ e2e/__tests__/coverageProviderV8.test.ts | 13 +++++++ e2e/__tests__/v8Coverage.test.ts | 38 ------------------- 4 files changed, 22 insertions(+), 63 deletions(-) delete mode 100644 e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap delete mode 100644 e2e/__tests__/v8Coverage.test.ts diff --git a/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap b/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap index 84ba85b0ff6e..618a5f2e86bb 100644 --- a/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap @@ -61,3 +61,12 @@ All files | 59.38 | 50 | 33.33 | 59.38 | uncovered.js | 0 | 0 | 0 | 0 | 1-8 --------------|---------|----------|---------|---------|------------------- `; + +exports[`prints coverage with empty sourcemaps 1`] = ` +----------|---------|----------|---------|---------|------------------- +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +----------|---------|----------|---------|---------|------------------- +All files | 100 | 100 | 100 | 100 | + types.ts | 100 | 100 | 100 | 100 | +----------|---------|----------|---------|---------|------------------- +`; diff --git a/e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap b/e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap deleted file mode 100644 index b2ec317a31d6..000000000000 --- a/e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`prints coverage with empty sourcemaps 1`] = ` -----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - types.ts | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- -`; - -exports[`prints coverage with missing sourcemaps 1`] = ` - console.log - 42 - - at Object.log (__tests__/Thing.test.js:10:9) - -----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - Thing.js | 100 | 100 | 100 | 100 | - x.css | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- -`; diff --git a/e2e/__tests__/coverageProviderV8.test.ts b/e2e/__tests__/coverageProviderV8.test.ts index 70cb220137d9..135de8af2621 100644 --- a/e2e/__tests__/coverageProviderV8.test.ts +++ b/e2e/__tests__/coverageProviderV8.test.ts @@ -11,6 +11,19 @@ import runJest from '../runJest'; const DIR = path.resolve(__dirname, '../coverage-provider-v8'); +test('prints coverage with empty sourcemaps', () => { + const sourcemapDir = path.join(DIR, 'empty-sourcemap'); + + const {stdout, exitCode} = runJest( + sourcemapDir, + ['--coverage', '--coverage-provider', 'v8'], + {stripAnsi: true}, + ); + + expect(exitCode).toBe(0); + expect(wrap(stdout)).toMatchSnapshot(); +}); + test('prints correct coverage report, if a CJS module is put under test without transformation', () => { const sourcemapDir = path.join(DIR, 'cjs-native-without-sourcemap'); diff --git a/e2e/__tests__/v8Coverage.test.ts b/e2e/__tests__/v8Coverage.test.ts deleted file mode 100644 index 199420b0fb84..000000000000 --- a/e2e/__tests__/v8Coverage.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import * as path from 'path'; -import wrap from 'jest-snapshot-serializer-raw'; -import runJest from '../runJest'; - -const DIR = path.resolve(__dirname, '../v8-coverage'); - -test('prints coverage with missing sourcemaps', () => { - const sourcemapDir = path.join(DIR, 'no-sourcemap'); - - const {stdout, exitCode} = runJest( - sourcemapDir, - ['--coverage', '--coverage-provider', 'v8'], - {stripAnsi: true}, - ); - - expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); -}); - -test('prints coverage with empty sourcemaps', () => { - const sourcemapDir = path.join(DIR, 'empty-sourcemap'); - - const {stdout, exitCode} = runJest( - sourcemapDir, - ['--coverage', '--coverage-provider', 'v8'], - {stripAnsi: true}, - ); - - expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); -});