Skip to content

Commit

Permalink
fix: add version to cache key (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari authored Jul 18, 2022
1 parent 52c516b commit dacdc72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import * as path from 'path'
import * as process from 'process'
import getCacheKeyFunction from '@jest/create-cache-key-function'
import type { Transformer, TransformOptions } from '@jest/transform'
import { transformSync, transform, Options } from '@swc/core'
import { transformSync, transform, Options, version as swcVersion } from '@swc/core'
import { version } from './package.json'

function createTransformer(swcTransformOpts?: Options & {
experimental?: {
Expand All @@ -20,7 +21,7 @@ function createTransformer(swcTransformOpts?: Options & {
}): Transformer {
const computedSwcOptions = buildSwcTransformOpts(swcTransformOpts)

const cacheKeyFunction = getCacheKeyFunction([], [JSON.stringify(computedSwcOptions)])
const cacheKeyFunction = getCacheKeyFunction([], [swcVersion, version, JSON.stringify(computedSwcOptions)])
const { enabled: canInstrument, ...instrumentOptions } = swcTransformOpts?.experimental?.customCoverageInstrumentation ?? {}
return {
canInstrument: !!canInstrument, // Tell jest we'll instrument by our own
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
"resolveJsonModule": true,

/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
Expand Down

0 comments on commit dacdc72

Please sign in to comment.