I am trying to start and stop serverless application through code. I am able to start and stop it once all tests pass. However when test fails globalTeardown
do not run. You can check sample project here: https://github.com/bilalsha/sls-test-jest/tree/fail_test
teardown.js
module.exports = async function() {
let slsOfflineProcess = global.__SERVERD__;
slsOfflineProcess.stdin.write('q\n');
slsOfflineProcess.stdin.pause();
await slsOfflineProcess.kill('SIGINT');
console.log('Serverless Offline stopped');
};
output
7 | expect(res.statusCode).toEqual(200);
> 8 | expect(res.body).toEqual('Go Serverless v1.0! Your function executed successfully!');
| ^
9 | });
10 | });
11 |
at Object.<anonymous> (handler.test.js:8:20)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 1.972s, estimated 2s
Ran all test suites.
npm ERR! Test failed. See above for more details.
Aucun commentaire:
Enregistrer un commentaire