Unverified Commit 1ee13baf authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure NODE_ENV is not inlined for next/jest (#33032)

parent ce3a3d8e
......@@ -7,6 +7,7 @@ const regeneratorRuntimePath = require.resolve(
function getBaseSWCOptions({
filename,
jest,
development,
hasReactRefresh,
globalWindow,
......@@ -50,15 +51,17 @@ function getBaseSWCOptions({
},
optimizer: {
simplify: false,
globals: {
typeofs: {
window: globalWindow ? 'object' : 'undefined',
},
envs: {
NODE_ENV: development ? '"development"' : '"production"',
},
// TODO: handle process.browser to match babel replacing as well
},
globals: jest
? null
: {
typeofs: {
window: globalWindow ? 'object' : 'undefined',
},
envs: {
NODE_ENV: development ? '"development"' : '"production"',
},
// TODO: handle process.browser to match babel replacing as well
},
},
regenerator: {
importPath: regeneratorRuntimePath,
......@@ -86,6 +89,7 @@ export function getJestSWCOptions({
}) {
let baseOptions = getBaseSWCOptions({
filename,
jest: true,
development: false,
hasReactRefresh: false,
globalWindow: !isServer,
......
/* eslint-env jest */
describe('jest next-swc preset', () => {
it('should have correct env', async () => {
expect(process.env.NODE_ENV).toBe('test')
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment