File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed
Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const regeneratorRuntimePath = require.resolve(
77
88function getBaseSWCOptions ( {
99 filename,
10+ jest,
1011 development,
1112 hasReactRefresh,
1213 globalWindow,
@@ -50,15 +51,17 @@ function getBaseSWCOptions({
5051 } ,
5152 optimizer : {
5253 simplify : false ,
53- globals : {
54- typeofs : {
55- window : globalWindow ? 'object' : 'undefined' ,
56- } ,
57- envs : {
58- NODE_ENV : development ? '"development"' : '"production"' ,
59- } ,
60- // TODO: handle process.browser to match babel replacing as well
61- } ,
54+ globals : jest
55+ ? null
56+ : {
57+ typeofs : {
58+ window : globalWindow ? 'object' : 'undefined' ,
59+ } ,
60+ envs : {
61+ NODE_ENV : development ? '"development"' : '"production"' ,
62+ } ,
63+ // TODO: handle process.browser to match babel replacing as well
64+ } ,
6265 } ,
6366 regenerator : {
6467 importPath : regeneratorRuntimePath ,
@@ -86,6 +89,7 @@ export function getJestSWCOptions({
8689} ) {
8790 let baseOptions = getBaseSWCOptions ( {
8891 filename,
92+ jest : true ,
8993 development : false ,
9094 hasReactRefresh : false ,
9195 globalWindow : ! isServer ,
Original file line number Diff line number Diff line change 1+ /* eslint-env jest */
2+
3+ describe ( 'jest next-swc preset' , ( ) => {
4+ it ( 'should have correct env' , async ( ) => {
5+ expect ( process . env . NODE_ENV ) . toBe ( 'test' )
6+ } )
7+ } )
You can’t perform that action at this time.
0 commit comments