Last active
February 2, 2021 20:53
-
-
Save nkhil/d375bfda79d97da6fa12624966c52878 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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