I am using GitLab's serverless framework template and trying to run tests locally first, by creating a child serverless offline process. I am getting the error 'spawn serverless ENOENT' when executing the jest tests. Any idea why?
let useLocalService = true
...
let serverlessProcess = {
serverless_process: null,
start: async () => {
if(useLocalService) {
this.serverless_process = spawn('serverless', ['offline', '--port', 3000])
}
},
stop: () => {
if(useLocalService) {
this.serverless_process.kill('SIGINT')
}
}
}
describe('hello', () => {
beforeAll(async () => {
// serverlessProcess.start starts serverless offline in a child process
// unless the test is pointed at a deployed service
await serverlessProcess.start()
})
afterAll(() => {
// serverlessProcess.stop kills the child process at the end of the test
// unless the test is pointed at a deployed service
serverlessProcess.stop()
})
it(...
The only error message I recieve:
● Test suite failed to run
spawn serverless ENOENT