Skip to content

Instantly share code, notes, and snippets.

@nkhil
Last active February 2, 2021 20:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nkhil/d375bfda79d97da6fa12624966c52878 to your computer and use it in GitHub Desktop.
const path = require('path');
const { spawn } = require('child_process');
// Run using Jest
describe('logger behaviour', () => {
it('logs out multiple params - 2 strings', done => {
const testAppFilePath = path.join(
__dirname,
'../logger.js',
)
const testApp = spawn('node', [testAppFilePath])
testApp.stdout.on('data', data => {
const stdoutData = JSON.parse(data.toString())
expect(stdoutData.msg).toBe('param2')
expect(stdoutData.foo).toBe('bar')
testApp.kill('SIGINT')
done()
})
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment