diff options
Diffstat (limited to 'config/jestEsbuildTransform.js')
-rw-r--r-- | config/jestEsbuildTransform.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/config/jestEsbuildTransform.js b/config/jestEsbuildTransform.js index 7c6a57c..4bf49e6 100644 --- a/config/jestEsbuildTransform.js +++ b/config/jestEsbuildTransform.js | |||
@@ -2,25 +2,22 @@ import { transform } from 'esbuild'; | |||
2 | 2 | ||
3 | import { node } from './buildConstants.js'; | 3 | import { node } from './buildConstants.js'; |
4 | 4 | ||
5 | export default { | 5 | /** @type {import('@jest/transform').AsyncTransformer<undefined>} */ |
6 | /** | 6 | const transformer = { |
7 | * @param {string} source | 7 | canInstrument: false, |
8 | * @param {string} filePath | ||
9 | * @param {import('@jest/types').Config.GlobalConfig} jestConfig | ||
10 | * @return {Promise<import('@jest/types').TransformTypes.TransformResult>} | ||
11 | */ | ||
12 | async processAsync(source, filePath) { | 8 | async processAsync(source, filePath) { |
13 | const { code } = await transform(source, { | 9 | const { code, map } = await transform(source, { |
14 | loader: filePath.endsWith('tsx') ? 'tsx' : 'ts', | 10 | loader: filePath.endsWith('tsx') ? 'tsx' : 'ts', |
15 | sourcefile: filePath, | 11 | sourcefile: filePath, |
16 | format: 'esm', | 12 | format: 'esm', |
17 | target: node, | 13 | target: node, |
18 | sourcemap: 'inline', | 14 | sourcemap: true, |
19 | }); | 15 | }); |
20 | return { | 16 | return { |
21 | code, | 17 | code, |
22 | originalCode: source, | 18 | map, |
23 | sourceMapPath: null, | ||
24 | }; | 19 | }; |
25 | }, | 20 | }, |
26 | }; | 21 | }; |
22 | |||
23 | export default transformer; | ||