Skip to content

Commit c48f7b8

Browse files
committed
perf: more cleaning
1 parent b7d71bb commit c48f7b8

12 files changed

Lines changed: 43 additions & 155 deletions

File tree

e2e/__tests__/__snapshots__/hoisting.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Hoisting test with template "default" should pass 1`] = `
3+
exports[`Hoisting test should pass using template "default" 1`] = `
44
jest exit code: 0
55
===[ STDOUT ]===================================================================
66
@@ -17,7 +17,7 @@ jest exit code: 0
1717
================================================================================
1818
`;
1919

20-
exports[`Hoisting test with template "with-babel-6" should pass 1`] = `
20+
exports[`Hoisting test should pass using template "with-babel-6" 1`] = `
2121
jest exit code: 0
2222
===[ STDOUT ]===================================================================
2323
@@ -34,7 +34,7 @@ jest exit code: 0
3434
================================================================================
3535
`;
3636

37-
exports[`Hoisting test with template "with-babel-7" should pass 1`] = `
37+
exports[`Hoisting test should pass using template "with-babel-7" 1`] = `
3838
jest exit code: 0
3939
===[ STDOUT ]===================================================================
4040
@@ -51,7 +51,7 @@ jest exit code: 0
5151
================================================================================
5252
`;
5353

54-
exports[`Hoisting test with template "with-jest-22" should pass 1`] = `
54+
exports[`Hoisting test should pass using template "with-jest-22" 1`] = `
5555
jest exit code: 0
5656
===[ STDOUT ]===================================================================
5757

e2e/__tests__/__snapshots__/simple.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Simple test with template "default" should pass 1`] = `
3+
exports[`Simple test should pass using template "default" 1`] = `
44
jest exit code: 0
55
===[ STDOUT ]===================================================================
66
@@ -17,7 +17,7 @@ jest exit code: 0
1717
================================================================================
1818
`;
1919

20-
exports[`Simple test with template "with-babel-6" should pass 1`] = `
20+
exports[`Simple test should pass using template "with-babel-6" 1`] = `
2121
jest exit code: 0
2222
===[ STDOUT ]===================================================================
2323
@@ -34,7 +34,7 @@ jest exit code: 0
3434
================================================================================
3535
`;
3636

37-
exports[`Simple test with template "with-babel-7" should pass 1`] = `
37+
exports[`Simple test should pass using template "with-babel-7" 1`] = `
3838
jest exit code: 0
3939
===[ STDOUT ]===================================================================
4040
@@ -51,7 +51,7 @@ jest exit code: 0
5151
================================================================================
5252
`;
5353

54-
exports[`Simple test with template "with-jest-22" should pass 1`] = `
54+
exports[`Simple test should pass using template "with-jest-22" 1`] = `
5555
jest exit code: 0
5656
===[ STDOUT ]===================================================================
5757

e2e/__tests__/__snapshots__/source-map.test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Source maps console.log() with template "default" should pass reporting correct line number 1`] = `
3+
exports[`Source maps console.log() should pass reporting correct line number using template "default" 1`] = `
44
jest exit code: 0
55
===[ STDOUT ]===================================================================
66
console.log echo.spec.ts:5
@@ -21,7 +21,7 @@ jest exit code: 0
2121
================================================================================
2222
`;
2323

24-
exports[`Source maps console.log() with template "with-babel-6" should pass reporting correct line number 1`] = `
24+
exports[`Source maps console.log() should pass reporting correct line number using template "with-babel-6" 1`] = `
2525
jest exit code: 0
2626
===[ STDOUT ]===================================================================
2727
console.log echo.spec.ts:5
@@ -42,7 +42,7 @@ jest exit code: 0
4242
================================================================================
4343
`;
4444

45-
exports[`Source maps console.log() with template "with-babel-7" should pass reporting correct line number 1`] = `
45+
exports[`Source maps console.log() should pass reporting correct line number using template "with-babel-7" 1`] = `
4646
jest exit code: 0
4747
===[ STDOUT ]===================================================================
4848
console.log echo.spec.ts:5
@@ -63,7 +63,7 @@ jest exit code: 0
6363
================================================================================
6464
`;
6565

66-
exports[`Source maps console.log() with template "with-jest-22" should pass reporting correct line number 1`] = `
66+
exports[`Source maps console.log() should pass reporting correct line number using template "with-jest-22" 1`] = `
6767
jest exit code: 0
6868
===[ STDOUT ]===================================================================
6969
console.log echo.spec.ts:5
@@ -84,7 +84,7 @@ jest exit code: 0
8484
================================================================================
8585
`;
8686

87-
exports[`Source maps throw new Error() with template "default" should fail reporting correct line number 1`] = `
87+
exports[`Source maps throw new Error() should fail reporting correct line number using template "default" 1`] = `
8888
jest exit code: 1
8989
===[ STDOUT ]===================================================================
9090
console.log echo.spec.ts:5
@@ -120,7 +120,7 @@ jest exit code: 1
120120
================================================================================
121121
`;
122122
123-
exports[`Source maps throw new Error() with template "with-babel-6" should fail reporting correct line number 1`] = `
123+
exports[`Source maps throw new Error() should fail reporting correct line number using template "with-babel-6" 1`] = `
124124
jest exit code: 1
125125
===[ STDOUT ]===================================================================
126126
console.log echo.spec.ts:5
@@ -156,7 +156,7 @@ jest exit code: 1
156156
================================================================================
157157
`;
158158
159-
exports[`Source maps throw new Error() with template "with-babel-7" should fail reporting correct line number 1`] = `
159+
exports[`Source maps throw new Error() should fail reporting correct line number using template "with-babel-7" 1`] = `
160160
jest exit code: 1
161161
===[ STDOUT ]===================================================================
162162
console.log echo.spec.ts:5
@@ -192,7 +192,7 @@ jest exit code: 1
192192
================================================================================
193193
`;
194194
195-
exports[`Source maps throw new Error() with template "with-jest-22" should fail reporting correct line number 1`] = `
195+
exports[`Source maps throw new Error() should fail reporting correct line number using template "with-jest-22" 1`] = `
196196
jest exit code: 1
197197
===[ STDOUT ]===================================================================
198198
console.log echo.spec.ts:5

e2e/__tests__/hoisting.test.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ import { allPackageSets } from '../__helpers__/templates';
44
describe('Hoisting test', () => {
55
const testCase = configureTestCase('hoisting', { args: ['--no-cache'] });
66

7-
testCase.runWithTemplates(
8-
allPackageSets,
9-
0,
10-
(runTest, { describeLabel, itLabel }) => {
11-
describe(describeLabel, () => {
12-
it(itLabel, () => {
13-
const result = runTest();
14-
expect(result.status).toBe(0);
15-
expect(result).toMatchSnapshot();
16-
});
17-
});
18-
},
19-
);
7+
testCase.runWithTemplates(allPackageSets, 0, (runTest, { testLabel }) => {
8+
it(testLabel, () => {
9+
const result = runTest();
10+
expect(result.status).toBe(0);
11+
expect(result).toMatchSnapshot();
12+
});
13+
});
2014
});

e2e/__tests__/simple.test.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ import { allPackageSets } from '../__helpers__/templates';
44
describe('Simple test', () => {
55
const testCase = configureTestCase('simple', { args: ['--no-cache'] });
66

7-
testCase.runWithTemplates(
8-
allPackageSets,
9-
0,
10-
(runTest, { describeLabel, itLabel }) => {
11-
describe(describeLabel, () => {
12-
it(itLabel, () => {
13-
const result = runTest();
14-
expect(result.status).toBe(0);
15-
expect(result).toMatchSnapshot();
16-
});
17-
});
18-
},
19-
);
7+
testCase.runWithTemplates(allPackageSets, 0, (runTest, { testLabel }) => {
8+
it(testLabel, () => {
9+
const result = runTest();
10+
expect(result.status).toBe(0);
11+
expect(result).toMatchSnapshot();
12+
});
13+
});
2014
});

e2e/__tests__/source-map.test.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ describe('Source maps', () => {
88
testCase.runWithTemplates(
99
allPackageSets,
1010
0,
11-
(runTest, { describeLabel }) => {
12-
describe(describeLabel, () => {
13-
it('should pass reporting correct line number', () => {
14-
const result = runTest();
15-
expect(result.status).toBe(0);
16-
expect(result).toMatchSnapshot();
17-
});
11+
(runTest, { templateName }) => {
12+
it(`should pass reporting correct line number using template "${templateName}"`, () => {
13+
const result = runTest();
14+
expect(result.status).toBe(0);
15+
expect(result).toMatchSnapshot();
1816
});
1917
},
2018
);
@@ -29,13 +27,11 @@ describe('Source maps', () => {
2927
testCase.runWithTemplates(
3028
allPackageSets,
3129
1,
32-
(runTest, { describeLabel }) => {
33-
describe(describeLabel, () => {
34-
it('should fail reporting correct line number', () => {
35-
const result = runTest();
36-
expect(result.status).toBe(1);
37-
expect(result).toMatchSnapshot();
38-
});
30+
(runTest, { templateName }) => {
31+
it(`should fail reporting correct line number using template "${templateName}"`, () => {
32+
const result = runTest();
33+
expect(result.status).toBe(1);
34+
expect(result).toMatchSnapshot();
3935
});
4036
},
4137
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DiagnosticTypes, DiagnosticSets, diagnosticSets } from '../types';
1+
import { DiagnosticTypes, DiagnosticSets, diagnosticSets } from './types';
22

33
export const isDiagnosticType = (val: any): val is DiagnosticTypes => {
44
return val && DiagnosticTypes[val] === val;

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { TsJestGlobalOptions, TsJestConfig } from './types';
33
import TsProgram from './ts-program';
44
import Memoize from './memoize';
5-
import { normalizeDiagnosticTypes } from './utils/diagnostics';
5+
import { normalizeDiagnosticTypes } from './diagnostics';
66

77
const rootDirFor = (jestConfig: jest.ProjectConfig): string => {
88
return jestConfig.rootDir || process.cwd();

src/transformers/manager.ts

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as _babelJest from 'babel-jest';
2-
import { CompilerOptions, Node } from 'typescript';
3-
import TransformationManager from './transformers/manager';
2+
import { CompilerOptions } from 'typescript';
43

54
export type TBabelJest = typeof _babelJest;
65

0 commit comments

Comments
 (0)