jest-puppeteer.config.js ignores headless settings in launch section

Created on 25 Apr 2018  路  5Comments  路  Source: smooth-code/jest-puppeteer

I would like to deactivate headless but my config is ignored.

jest-puppeteer.config.js:

module.exports = {
  launch: {
    //dumpio: true,
    headless: false, //process.env.HEADLESS !== 'false',
    devtools: true
  }
};

Directory structure:

/application

package.json
jest-puppeteer.config.js
.babelrc
/src

__tests__

registration.js

package.json:

{
  "name": "tests",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "babel-core": "^6.26.0",
    "babel-jest": "^22.4.3",
    "babel-preset-env": "^1.6.1",
    "jest": "^22.4.3",
    "jest-puppeteer": "^2.4.0",
    "puppeteer": "^1.3.0"
  },
  "scripts": {
    "start": "jest",
    "test": "jest"
  },
  "jest": {
    "preset": "jest-puppeteer"
  }
}

Most helpful comment

I found the problem - running jest in the VS CODE terminal window will block showing the browser window. To be clear - all test are done fine but you will never see any browser window.

Running the same setup in a normal terminal will show the browser window.

All 5 comments

jest-puppeteer.config.js must be at the root of your project, you can also set a custom path using an environment variable. https://github.com/smooth-code/jest-puppeteer/blob/master/packages/jest-environment-puppeteer/src/readConfig.js#L25-L27

Thank You :-) same result with - also tried with a absolute path:
JEST_PUPPETEER_CONFIG=jest-puppeteer.config.js yarn start

How can I debug this problem?

I did a check with this config:

module.exports = {
  server: {
    command: 'touch /tmp/test.txt'
  },
  launch: {

    headless: false,
    devtools: true
  }
};

the config is included and the command is executed - @neoziro what makes it ignore the headless settings?

I found the problem - running jest in the VS CODE terminal window will block showing the browser window. To be clear - all test are done fine but you will never see any browser window.

Running the same setup in a normal terminal will show the browser window.

jest-puppeteer.config.js must be at the root of your project, you can also set a custom path using an environment variable. https://github.com/smooth-code/jest-puppeteer/blob/master/packages/jest-environment-puppeteer/src/readConfig.js#L25-L27

@neoziro

it also looks like jest-puppeteer.config.js will used only if you run "jest" in the homepage of the testsuite,

but if you have a test, e.g. homepage.test.js in a test folder, e.g. test/homepage.test.js , and you run jest homepage.test.js (inside the test folder), jest-puppeteer.config.js will not be used.

i'm right?

thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xiaoyuhen picture xiaoyuhen  路  5Comments

Pyrolistical picture Pyrolistical  路  6Comments

binhxn picture binhxn  路  6Comments

joshpitzalis picture joshpitzalis  路  3Comments

timwis picture timwis  路  5Comments