|
| 1 | +/** |
| 2 | + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. |
| 3 | + * |
| 4 | + * This source code is licensed under the MIT license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + */ |
| 7 | + |
| 8 | +import * as path from 'path'; |
| 9 | +import {onNodeVersions} from '@jest/test-utils'; |
| 10 | +import runJest from '../runJest'; |
| 11 | + |
| 12 | +const DIR = path.resolve(__dirname, '../v8-coverage'); |
| 13 | + |
| 14 | +onNodeVersions('>=10', () => { |
| 15 | + test('prints coverage', () => { |
| 16 | + const sourcemapDir = path.join(DIR, 'no-sourcemap'); |
| 17 | + const {stdout, exitCode} = runJest( |
| 18 | + sourcemapDir, |
| 19 | + ['--coverage', '--coverage-provider', 'v8'], |
| 20 | + { |
| 21 | + stripAnsi: true, |
| 22 | + }, |
| 23 | + ); |
| 24 | + |
| 25 | + expect(exitCode).toBe(0); |
| 26 | + expect( |
| 27 | + '\n' + |
| 28 | + stdout |
| 29 | + .split('\n') |
| 30 | + .map(s => s.trimRight()) |
| 31 | + .join('\n') + |
| 32 | + '\n', |
| 33 | + ).toEqual(` |
| 34 | + console.log __tests__/Thing.test.js:10 |
| 35 | + 42 |
| 36 | +
|
| 37 | +----------|---------|----------|---------|---------|------------------- |
| 38 | +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
| 39 | +----------|---------|----------|---------|---------|------------------- |
| 40 | +All files | 100 | 100 | 100 | 100 | |
| 41 | + Thing.js | 100 | 100 | 100 | 100 | |
| 42 | + x.css | 100 | 100 | 100 | 100 | |
| 43 | +----------|---------|----------|---------|---------|------------------- |
| 44 | +`); |
| 45 | + }); |
| 46 | +}); |
0 commit comments