Skip to content

Commit

Permalink
Fix tests and add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Dec 7, 2021
1 parent 765605d commit 30f738e
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions test/integration/non-standard-node-env-warning/test/index.test.js
Expand Up @@ -9,6 +9,7 @@ import {
waitFor,
initNextServerScript,
nextBuild,
nextStart,
} from 'next-test-utils'

const appDir = join(__dirname, '..')
Expand Down Expand Up @@ -135,14 +136,42 @@ describe('Non-Standard NODE_ENV', () => {
await killApp(app)
expect(output).toContain(warningText)
})
it('should show the warning with NODE_ENV set to production with dev command', async () => {

it('should show the warning with NODE_ENV set to production with next dev', async () => {
let output = ''

app = await launchApp(appDir, await findPort(), {
env: {
NODE_ENV: 'production',
},
onStdout(msg) {
onStderr(msg) {
output += msg || ''
},
})
await waitFor(2000)
await killApp(app)
expect(output).toContain(warningText)
})

it('should show the warning with NODE_ENV set to development with next build', async () => {
const { stderr } = await nextBuild(appDir, [], {
env: {
NODE_ENV: 'development',
},
stderr: true,
})
expect(stderr).toContain(warningText)
})

it('should show the warning with NODE_ENV set to development with next start', async () => {
let output = ''

await nextBuild(appDir)
app = await nextStart(appDir, await findPort(), {
env: {
NODE_ENV: 'development',
},
onStderr(msg) {
output += msg || ''
},
})
Expand Down

0 comments on commit 30f738e

Please sign in to comment.