diff options
Diffstat (limited to 'config/jestEsbuildTransformer.js')
-rw-r--r-- | config/jestEsbuildTransformer.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/config/jestEsbuildTransformer.js b/config/jestEsbuildTransformer.js index b6f2fc3..6a4760f 100644 --- a/config/jestEsbuildTransformer.js +++ b/config/jestEsbuildTransformer.js | |||
@@ -4,7 +4,7 @@ import { node } from './buildConstants.js'; | |||
4 | 4 | ||
5 | /** | 5 | /** |
6 | * @param {string} source | 6 | * @param {string} source |
7 | * @param {import('@jest/types').Config.Path} filePath | 7 | * @param {string} filePath |
8 | * @return {Promise<import('@jest/transform').TransformedSource>} | 8 | * @return {Promise<import('@jest/transform').TransformedSource>} |
9 | */ | 9 | */ |
10 | async function processAsync(source, filePath) { | 10 | async function processAsync(source, filePath) { |
@@ -14,6 +14,16 @@ async function processAsync(source, filePath) { | |||
14 | format: 'esm', | 14 | format: 'esm', |
15 | target: node, | 15 | target: node, |
16 | sourcemap: true, | 16 | sourcemap: true, |
17 | define: { | ||
18 | __DEV__: JSON.stringify(false), // For mobx | ||
19 | 'process.env.NODE_ENV': 'test', | ||
20 | 'process.env.MODE': 'test', | ||
21 | 'import.meta.env': JSON.stringify({ | ||
22 | DEV: false, | ||
23 | MODE: 'test', | ||
24 | PROD: true, | ||
25 | }), | ||
26 | }, | ||
17 | }); | 27 | }); |
18 | return { | 28 | return { |
19 | code, | 29 | code, |