Skip to content

Commit

Permalink
perf: more cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
huafu committed Aug 10, 2018
1 parent b7d71bb commit c48f7b8
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 155 deletions.
8 changes: 4 additions & 4 deletions e2e/__tests__/__snapshots__/hoisting.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Hoisting test with template "default" should pass 1`] = `
exports[`Hoisting test should pass using template "default" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand All @@ -17,7 +17,7 @@ jest exit code: 0
================================================================================
`;

exports[`Hoisting test with template "with-babel-6" should pass 1`] = `
exports[`Hoisting test should pass using template "with-babel-6" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand All @@ -34,7 +34,7 @@ jest exit code: 0
================================================================================
`;

exports[`Hoisting test with template "with-babel-7" should pass 1`] = `
exports[`Hoisting test should pass using template "with-babel-7" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand All @@ -51,7 +51,7 @@ jest exit code: 0
================================================================================
`;

exports[`Hoisting test with template "with-jest-22" should pass 1`] = `
exports[`Hoisting test should pass using template "with-jest-22" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand Down
8 changes: 4 additions & 4 deletions e2e/__tests__/__snapshots__/simple.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Simple test with template "default" should pass 1`] = `
exports[`Simple test should pass using template "default" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand All @@ -17,7 +17,7 @@ jest exit code: 0
================================================================================
`;

exports[`Simple test with template "with-babel-6" should pass 1`] = `
exports[`Simple test should pass using template "with-babel-6" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand All @@ -34,7 +34,7 @@ jest exit code: 0
================================================================================
`;

exports[`Simple test with template "with-babel-7" should pass 1`] = `
exports[`Simple test should pass using template "with-babel-7" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand All @@ -51,7 +51,7 @@ jest exit code: 0
================================================================================
`;

exports[`Simple test with template "with-jest-22" should pass 1`] = `
exports[`Simple test should pass using template "with-jest-22" 1`] = `
jest exit code: 0
===[ STDOUT ]===================================================================
Expand Down
16 changes: 8 additions & 8 deletions e2e/__tests__/__snapshots__/source-map.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

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

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

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

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

exports[`Source maps throw new Error() with template "default" should fail reporting correct line number 1`] = `
exports[`Source maps throw new Error() should fail reporting correct line number using template "default" 1`] = `
jest exit code: 1
===[ STDOUT ]===================================================================
console.log echo.spec.ts:5
Expand Down Expand Up @@ -120,7 +120,7 @@ jest exit code: 1
================================================================================
`;
exports[`Source maps throw new Error() with template "with-babel-6" should fail reporting correct line number 1`] = `
exports[`Source maps throw new Error() should fail reporting correct line number using template "with-babel-6" 1`] = `
jest exit code: 1
===[ STDOUT ]===================================================================
console.log echo.spec.ts:5
Expand Down Expand Up @@ -156,7 +156,7 @@ jest exit code: 1
================================================================================
`;
exports[`Source maps throw new Error() with template "with-babel-7" should fail reporting correct line number 1`] = `
exports[`Source maps throw new Error() should fail reporting correct line number using template "with-babel-7" 1`] = `
jest exit code: 1
===[ STDOUT ]===================================================================
console.log echo.spec.ts:5
Expand Down Expand Up @@ -192,7 +192,7 @@ jest exit code: 1
================================================================================
`;
exports[`Source maps throw new Error() with template "with-jest-22" should fail reporting correct line number 1`] = `
exports[`Source maps throw new Error() should fail reporting correct line number using template "with-jest-22" 1`] = `
jest exit code: 1
===[ STDOUT ]===================================================================
console.log echo.spec.ts:5
Expand Down
20 changes: 7 additions & 13 deletions e2e/__tests__/hoisting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ import { allPackageSets } from '../__helpers__/templates';
describe('Hoisting test', () => {
const testCase = configureTestCase('hoisting', { args: ['--no-cache'] });

testCase.runWithTemplates(
allPackageSets,
0,
(runTest, { describeLabel, itLabel }) => {
describe(describeLabel, () => {
it(itLabel, () => {
const result = runTest();
expect(result.status).toBe(0);
expect(result).toMatchSnapshot();
});
});
},
);
testCase.runWithTemplates(allPackageSets, 0, (runTest, { testLabel }) => {
it(testLabel, () => {
const result = runTest();
expect(result.status).toBe(0);
expect(result).toMatchSnapshot();
});
});
});
20 changes: 7 additions & 13 deletions e2e/__tests__/simple.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ import { allPackageSets } from '../__helpers__/templates';
describe('Simple test', () => {
const testCase = configureTestCase('simple', { args: ['--no-cache'] });

testCase.runWithTemplates(
allPackageSets,
0,
(runTest, { describeLabel, itLabel }) => {
describe(describeLabel, () => {
it(itLabel, () => {
const result = runTest();
expect(result.status).toBe(0);
expect(result).toMatchSnapshot();
});
});
},
);
testCase.runWithTemplates(allPackageSets, 0, (runTest, { testLabel }) => {
it(testLabel, () => {
const result = runTest();
expect(result.status).toBe(0);
expect(result).toMatchSnapshot();
});
});
});
24 changes: 10 additions & 14 deletions e2e/__tests__/source-map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ describe('Source maps', () => {
testCase.runWithTemplates(
allPackageSets,
0,
(runTest, { describeLabel }) => {
describe(describeLabel, () => {
it('should pass reporting correct line number', () => {
const result = runTest();
expect(result.status).toBe(0);
expect(result).toMatchSnapshot();
});
(runTest, { templateName }) => {
it(`should pass reporting correct line number using template "${templateName}"`, () => {
const result = runTest();
expect(result.status).toBe(0);
expect(result).toMatchSnapshot();
});
},
);
Expand All @@ -29,13 +27,11 @@ describe('Source maps', () => {
testCase.runWithTemplates(
allPackageSets,
1,
(runTest, { describeLabel }) => {
describe(describeLabel, () => {
it('should fail reporting correct line number', () => {
const result = runTest();
expect(result.status).toBe(1);
expect(result).toMatchSnapshot();
});
(runTest, { templateName }) => {
it(`should fail reporting correct line number using template "${templateName}"`, () => {
const result = runTest();
expect(result.status).toBe(1);
expect(result).toMatchSnapshot();
});
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/diagnostics.ts → src/diagnostics.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DiagnosticTypes, DiagnosticSets, diagnosticSets } from '../types';
import { DiagnosticTypes, DiagnosticSets, diagnosticSets } from './types';

export const isDiagnosticType = (val: any): val is DiagnosticTypes => {
return val && DiagnosticTypes[val] === val;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { TsJestGlobalOptions, TsJestConfig } from './types';
import TsProgram from './ts-program';
import Memoize from './memoize';
import { normalizeDiagnosticTypes } from './utils/diagnostics';
import { normalizeDiagnosticTypes } from './diagnostics';

const rootDirFor = (jestConfig: jest.ProjectConfig): string => {
return jestConfig.rootDir || process.cwd();
Expand Down
71 changes: 0 additions & 71 deletions src/transformers/manager.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as _babelJest from 'babel-jest';
import { CompilerOptions, Node } from 'typescript';
import TransformationManager from './transformers/manager';
import { CompilerOptions } from 'typescript';

export type TBabelJest = typeof _babelJest;

Expand Down
4 changes: 0 additions & 4 deletions src/utils/file-extension.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/utils/ts-internals.ts

This file was deleted.

0 comments on commit c48f7b8

Please sign in to comment.