Hello, I have just started trying to configure CircleCI for my Node.js project (a Gatsby static site). The build runs fine, but Jest tests seem to be skipping the beforeAll step where I’m launching my Puppeteer server. (test
command is jest test/
). The same test works fine locally (I can see that the puppeteer browser gets created).
Would you have an idea? Below is a screenshot of the CircleCI error as well as an excerpt of my demo test file. Thank you very much for any help.
const puppeteer = require('puppeteer')
let browser
beforeAll(async () => {
console.log("beforeAll: launching browser") // --> gets printed
browser = await puppeteer.launch()
console.log("beforeAll: browser launched") // --> doesn't get printed
})
test('index', async () => {
console.log("test: Browser is:", browser) // --> shows that browser is undefined
const page = await browser.newPage() // --> throws TypeError: Cannot read property 'newPage' of undefined
...
})