serverless-jest-plugin icon indicating copy to clipboard operation
serverless-jest-plugin copied to clipboard

Is it possible to run jest in watch mode?

Open lewisblackwood opened this issue 8 years ago • 2 comments

Thanks for your work on this 👍

Is it possible to run Jest in watch mode with this plugin?

I couldn't find any reference in the docs. It would be a really useful feature to add if possible!

lewisblackwood avatar Aug 08 '17 13:08 lewisblackwood

I try to make it working by passing watch into jestrunCLI() but it doesn't seems that easy.

Would really appreciate if someone can guide us here.

kinyat avatar Aug 22 '17 00:08 kinyat

The problem is the way the configuration is passed into runCLI in run-tests.js

BEFORE

return runCLI({ config },

AFTER

const cliOptions = { config }
if (config.watch === true) {
   cliOptions.watch = config.watch
}
return runCLI(cliOptions,

In my serverless.yml file

plugins:
  - serverless-jest-plugin
custom:
  jest:
    collectCoverage: true
    watch: true

I'll do a pull request at some point ...

samiratworktango avatar Jul 17 '18 11:07 samiratworktango