Skip to content

Commit

Permalink
Merge 9cdbc47 into f5b0a62
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Oct 11, 2020
2 parents f5b0a62 + 9cdbc47 commit 9641345
Show file tree
Hide file tree
Showing 13 changed files with 339 additions and 642 deletions.
15 changes: 6 additions & 9 deletions e2e/__cases__/ts-jest-checks/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { createTransformer } from 'ts-jest'
import { readFileSync } from 'fs'
import { ConfigSet } from 'ts-jest/dist/config/config-set'

describe('tsConfig', () => {
it('should have digest and versions', () => {
const tr = createTransformer()
const cs = tr.configsFor(Object.create(null))
expect(cs.tsJestDigest).toHaveLength(40)
expect(cs.tsJestDigest).toBe(readFileSync(require.resolve('ts-jest/.ts-jest-digest'), 'utf8'))
expect(cs.versions['ts-jest']).toBe(require('ts-jest/package.json').version)
})
it('should have digest and versions', () => {
const cs = new ConfigSet(Object.create(null))
expect(cs.tsJestDigest).toHaveLength(40)
expect(cs.tsJestDigest).toBe(readFileSync(require.resolve('ts-jest/.ts-jest-digest'), 'utf8'))
expect(cs.versions['ts-jest']).toBe(require('ts-jest/package.json').version)
})
6 changes: 3 additions & 3 deletions e2e/__tests__/__snapshots__/logger.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Array [
"[level:20] creating Importer singleton",
"[level:20] checking version of jest: OK",
"[level:20] created new transformer",
"[level:20] computing cache key for <cwd>/Hello.spec.ts",
"[level:30] no matching config-set found, creating a new one",
"[level:20] backporting config",
"[level:20] normalized jest config",
Expand All @@ -18,6 +17,7 @@ Array [
"[level:20] checking version of typescript: OK",
"[level:20] readTsConfig(): reading <cwd>/tsconfig.json",
"[level:20] normalized typescript config",
"[level:20] computing cache key for <cwd>/Hello.spec.ts",
"[level:20] processing <cwd>/Hello.spec.ts",
"[level:20] initializeLanguageServiceInstance(): create typescript compiler",
"[level:20] file caching disabled",
Expand All @@ -44,7 +44,6 @@ Array [
"[level:20] creating Importer singleton",
"[level:20] checking version of jest: OK",
"[level:20] created new transformer",
"[level:20] computing cache key for <cwd>/Hello.spec.ts",
"[level:30] no matching config-set found, creating a new one",
"[level:20] backporting config",
"[level:20] normalized jest config",
Expand All @@ -55,6 +54,7 @@ Array [
"[level:20] checking version of typescript: OK",
"[level:20] readTsConfig(): reading <cwd>/tsconfig.json",
"[level:20] normalized typescript config",
"[level:20] computing cache key for <cwd>/Hello.spec.ts",
"[level:20] processing <cwd>/Hello.spec.ts",
"[level:20] creating babel-jest transformer",
"[level:20] loaded module babel-jest",
Expand Down Expand Up @@ -87,7 +87,6 @@ Array [
"[level:20] creating Importer singleton",
"[level:20] checking version of jest: OK",
"[level:20] created new transformer",
"[level:20] computing cache key for <cwd>/Hello.spec.ts",
"[level:30] no matching config-set found, creating a new one",
"[level:20] backporting config",
"[level:20] normalized jest config",
Expand All @@ -99,6 +98,7 @@ Array [
"[level:20] checking version of typescript: OK",
"[level:20] readTsConfig(): reading <cwd>/tsconfig.json",
"[level:20] normalized typescript config",
"[level:20] computing cache key for <cwd>/Hello.spec.ts",
"[level:20] processing <cwd>/Hello.spec.ts",
"[level:20] creating babel-jest transformer",
"[level:20] loaded module babel-jest",
Expand Down
70 changes: 35 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
},
"homepage": "https://kulshekhar.github.io/ts-jest",
"dependencies": {
"@jest/create-cache-key-function": "^26.5.0",
"@types/jest": "26.x",
"bs-logger": "0.x",
"buffer-from": "1.x",
Expand Down
16 changes: 16 additions & 0 deletions src/__snapshots__/ts-jest-transformer.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`TsJestTransformer process should process file with babel-jest 1`] = `
"foo;
//# "
`;

exports[`TsJestTransformer process should process file with babel-jest 2`] = `
"[level:40] Got a unknown file type to compile (file: foo.bar). To fix this, in your Jest config change the \`transform\` key which value is \`ts-jest\` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the \`transform\` option with value \`babel-jest\` which key matches this type of files.
"
`;

exports[`TsJestTransformer process should process file with babel-jest 3`] = `
"foo;
//# "
`;
2 changes: 1 addition & 1 deletion src/compiler/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { stringify } from '../utils/json'
/**
* Rely on TypeScript compiled output generation which contains this prefix to point to sourcemap location.
*/
const SOURCE_MAPPING_PREFIX = 'sourceMappingURL='
export const SOURCE_MAPPING_PREFIX = 'sourceMappingURL='

/**
* Update the output remapping the source map.
Expand Down
70 changes: 0 additions & 70 deletions src/config/__snapshots__/config-set.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`cacheKey should be a string 1`] = `"{\\"digest\\":\\"a0d51ca854194df8191d0e65c0ca4730f510f332\\",\\"jest\\":{\\"__backported\\":true,\\"globals\\":{}},\\"transformers\\":[\\"hoisting-jest-mock@4\\"],\\"tsJest\\":{\\"compiler\\":\\"typescript\\",\\"diagnostics\\":{\\"ignoreCodes\\":[6059,18002,18003],\\"pretty\\":true,\\"throws\\":true},\\"isolatedModules\\":false,\\"packageJson\\":{\\"kind\\":\\"file\\"},\\"transformers\\":{},\\"tsConfig\\":{\\"kind\\":\\"file\\",\\"value\\":\\"\\"}},\\"tsconfig\\":{\\"options\\":{\\"configFilePath\\":\\"\\",\\"declaration\\":false,\\"inlineSourceMap\\":false,\\"inlineSources\\":true,\\"module\\":1,\\"noEmit\\":false,\\"removeComments\\":false,\\"sourceMap\\":true,\\"target\\":1,\\"types\\":[]},\\"raw\\":{\\"compileOnSave\\":false,\\"compilerOptions\\":{\\"composite\\":true,\\"declaration\\":true,\\"types\\":[]},\\"exclude\\":[\\"foo/**/*\\"],\\"include\\":[\\"bar/**/*\\"]}}}"`;

exports[`isTestFile should return a boolean value whether the file matches test pattern 1`] = `true`;

exports[`isTestFile should return a boolean value whether the file matches test pattern 2`] = `true`;
Expand All @@ -10,74 +8,6 @@ exports[`isTestFile should return a boolean value whether the file matches test

exports[`isTestFile should return a boolean value whether the file matches test pattern 4`] = `true`;

exports[`jsonValue should create jsonValue based on each config and version 1`] = `
Object {
"babel": undefined,
"digest": "a0d51ca854194df8191d0e65c0ca4730f510f332",
"jest": Object {
"__backported": true,
"cacheDirectory": undefined,
"globals": Object {},
"name": undefined,
},
"transformers": Array [
"hoisting-jest-mock@4",
],
"tsJest": Object {
"babelConfig": undefined,
"compiler": "typescript",
"diagnostics": Object {
"ignoreCodes": Array [
6059,
18002,
18003,
],
"pretty": true,
"throws": true,
},
"isolatedModules": false,
"packageJson": Object {
"kind": "file",
"value": undefined,
},
"stringifyContentPathRegex": undefined,
"transformers": Object {},
"tsConfig": Object {
"kind": "file",
"value": "",
},
},
"tsconfig": Object {
"options": Object {
"configFilePath": "",
"declaration": false,
"inlineSourceMap": false,
"inlineSources": true,
"module": 1,
"noEmit": false,
"removeComments": false,
"sourceMap": true,
"target": 1,
"types": Array [],
},
"raw": Object {
"compileOnSave": false,
"compilerOptions": Object {
"composite": true,
"declaration": true,
"types": Array [],
},
"exclude": Array [
"foo/**/*",
],
"include": Array [
"bar/**/*",
],
},
},
}
`;

exports[`readTsConfig resolve configFileName normally module in tsConfig is not the same as forced module and allowSyntheticDefaultImports is false in tsConfig should use correct paths when searching 1`] = `
Array [
Object {
Expand Down

0 comments on commit 9641345

Please sign in to comment.