-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test for NODE_ENV in server process for #184
- Loading branch information
Showing
4 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* eslint-env mocha */ | ||
const la = require('lazy-ass') | ||
const execaWrap = require('execa-wrap') | ||
const path = require('path') | ||
|
||
describe('test-node-env', () => { | ||
// for https://github.com/bahmutov/start-server-and-test/issues/184 | ||
it('passes NODE_ENV to the server process', () => { | ||
const cwd = path.join(__dirname, 'test-node-env') | ||
return execaWrap('npm', ['run', 'demo'], { | ||
env: { | ||
NODE_ENV: 'test' | ||
}, | ||
cwd, | ||
filter: ['stdout'] | ||
}).then(result => { | ||
la( | ||
result.includes('server has NODE_ENV=test'), | ||
'result does not pass the right NODE_ENV to the server process', | ||
result | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "test-node-env", | ||
"scripts": { | ||
"start": "node ../server", | ||
"test": "echo server has NODE_ENV=$NODE_ENV", | ||
"demo": "node ../../src/bin/start.js 9000" | ||
} | ||
} |