My jest-puppeteer.config.js is
module.exports = {
server: {
command: 'node puppeteer/server-storybook.js',
},
...
And sometimes I have a network error: tests are trying to reach node process, which is launching, but not completely launched.
Is it possible to tell jest-puppeteer wait until ping localhost:3000 will be ok? Or, at least, tell to wait some amount of milliseconds.
Now I have to set await sleep(1000) before each test suit, which is not convenient.
The problem could be critical in case if you are launching something heavy like webpack-dev-server.
It is already possible using port option. See https://github.com/smooth-code/jest-puppeteer#jest-puppeteerconfigjs
I use it in all my projects:
module.exports = {
launch: {
headless: process.env.HEADLESS !== 'false',
},
server: {
command: 'yarn babel-node src/server/main.js',
port: 4444,
},
}
Most helpful comment
It is already possible using
portoption. See https://github.com/smooth-code/jest-puppeteer#jest-puppeteerconfigjsI use it in all my projects: