-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactor TsJestTransformer
- Use `@jest/create-cache-key-function` to create cache key - Rename interface `ConfigSetItem` -> `CachedConfigSet` - Rename field `configSetItems` -> `cachedConfigSets` - Remove `configsFor` and replace with `createOrResolveTransformerCfg`
- Loading branch information
Showing
11 changed files
with
316 additions
and
473 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,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) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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; | ||
//# " | ||
`; |
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
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
Oops, something went wrong.