forked from kulshekhar/ts-jest
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(babel): instrumentation was done twice when using babel
Closes kulshekhar#713
- Loading branch information
Showing
5 changed files
with
163 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export class Hello { | ||
constructor(readonly msg: string) {} | ||
|
||
get upper() { | ||
return this.msg.toUpperCase() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`using template "default" should report coverages 1`] = ` | ||
√ jest --coverage | ||
↳ exit code: 0 | ||
===[ STDOUT ]=================================================================== | ||
----------|----------|----------|----------|----------|-------------------| | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | ||
----------|----------|----------|----------|----------|-------------------| | ||
All files | 83.33 | 100 | 66.67 | 80 | | | ||
Hello.ts | 83.33 | 100 | 66.67 | 80 | 5 | | ||
----------|----------|----------|----------|----------|-------------------| | ||
===[ STDERR ]=================================================================== | ||
PASS ./Hello.spec.ts | ||
Hello Class | ||
√ should create a new Hello | ||
Test Suites: 1 passed, 1 total | ||
Tests: 1 passed, 1 total | ||
Snapshots: 0 total | ||
Time: XXs | ||
Ran all test suites. | ||
================================================================================ | ||
`; | ||
|
||
exports[`using template "with-babel-6" should report coverages 1`] = ` | ||
√ jest --coverage | ||
↳ exit code: 0 | ||
===[ STDOUT ]=================================================================== | ||
----------|----------|----------|----------|----------|-------------------| | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | ||
----------|----------|----------|----------|----------|-------------------| | ||
All files | 83.33 | 100 | 66.67 | 80 | | | ||
Hello.ts | 83.33 | 100 | 66.67 | 80 | 5 | | ||
----------|----------|----------|----------|----------|-------------------| | ||
===[ STDERR ]=================================================================== | ||
PASS ./Hello.spec.ts | ||
Hello Class | ||
√ should create a new Hello | ||
Test Suites: 1 passed, 1 total | ||
Tests: 1 passed, 1 total | ||
Snapshots: 0 total | ||
Time: XXs | ||
Ran all test suites. | ||
================================================================================ | ||
`; | ||
|
||
exports[`using template "with-babel-7" should report coverages 1`] = ` | ||
√ jest --coverage | ||
↳ exit code: 0 | ||
===[ STDOUT ]=================================================================== | ||
----------|----------|----------|----------|----------|-------------------| | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | ||
----------|----------|----------|----------|----------|-------------------| | ||
All files | 83.33 | 100 | 66.67 | 80 | | | ||
Hello.ts | 83.33 | 100 | 66.67 | 80 | 5 | | ||
----------|----------|----------|----------|----------|-------------------| | ||
===[ STDERR ]=================================================================== | ||
PASS ./Hello.spec.ts | ||
Hello Class | ||
√ should create a new Hello | ||
Test Suites: 1 passed, 1 total | ||
Tests: 1 passed, 1 total | ||
Snapshots: 0 total | ||
Time: XXs | ||
Ran all test suites. | ||
================================================================================ | ||
`; | ||
|
||
exports[`using template "with-jest-22" should report coverages 1`] = ` | ||
√ jest --coverage | ||
↳ exit code: 0 | ||
===[ STDOUT ]=================================================================== | ||
----------|----------|----------|----------|----------|-------------------| | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | ||
----------|----------|----------|----------|----------|-------------------| | ||
All files | 83.33 | 100 | 66.67 | 80 | | | ||
Hello.ts | 83.33 | 100 | 66.67 | 80 | 5 | | ||
----------|----------|----------|----------|----------|-------------------| | ||
===[ STDERR ]=================================================================== | ||
PASS ./Hello.spec.ts | ||
Hello Class | ||
√ should create a new Hello | ||
Test Suites: 1 passed, 1 total | ||
Tests: 1 passed, 1 total | ||
Snapshots: 0 total | ||
Time: XXs | ||
Ran all test suites. | ||
================================================================================ | ||
`; | ||
|
||
exports[`using template "with-typescript-2-7" should report coverages 1`] = ` | ||
√ jest --coverage | ||
↳ exit code: 0 | ||
===[ STDOUT ]=================================================================== | ||
----------|----------|----------|----------|----------|-------------------| | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | ||
----------|----------|----------|----------|----------|-------------------| | ||
All files | 83.33 | 100 | 66.67 | 80 | | | ||
Hello.ts | 83.33 | 100 | 66.67 | 80 | 5 | | ||
----------|----------|----------|----------|----------|-------------------| | ||
===[ STDERR ]=================================================================== | ||
PASS ./Hello.spec.ts | ||
Hello Class | ||
√ should create a new Hello | ||
Test Suites: 1 passed, 1 total | ||
Tests: 1 passed, 1 total | ||
Snapshots: 0 total | ||
Time: XXs | ||
Ran all test suites. | ||
================================================================================ | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { allValidPackageSets } from '../__helpers__/templates' | ||
import { configureTestCase } from '../__helpers__/test-case' | ||
|
||
const testCase = configureTestCase('simple', { | ||
args: ['--coverage'], | ||
}) | ||
|
||
testCase.runWithTemplates(allValidPackageSets, 0, (runTest, { templateName }) => { | ||
describe(`using template "${templateName}"`, () => { | ||
const result = runTest() | ||
|
||
it(`should report coverages`, () => { | ||
expect(result.status).toBe(0) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters