Vscode-jest: jest runner doesn't runInBand as per defined in package.json

Created on 10 Oct 2018  路  3Comments  路  Source: jest-community/vscode-jest

Environment

  1. node -v: 8.11.4
  2. npm -v: 5.6.0
  3. npm ls jest or npm ls react-scripts (if you haven鈥檛 ejected): [email protected]
  4. your vscode-jest settings if customized:

    • jest.pathToJest? empty

    • jest.pathToConfig? empty

    • anything else that you think might be relevant? [fill]

//jest.config.js

module.exports = {
    moduleNameMapper: {
        '@/(.*)$': '<rootDir>/src/$1',
        'neo/(.*)$': '<rootDir>/neo/$1',
    },
    testEnvironment: 'node',
    setupTestFrameworkScriptFile: './test/bootstrap.js',
    verbose: false,
};

//package.json

    "scripts": {
...
        "test": "jest --runInBand src",
        "test:setup": "babel-node build/jest_build_test_files.js",
        "test:watch": "jest --runInBand --watch server",
        "coverage": "jest --collectCoverageFrom=server/**.js --coverage server"
    },
  1. Operating system: macOS 10.14

Prerequisite

  • are you able to run jest test from command line? yes
  • how do yo run your tests from command line? npm run test

Expected Behavior

To run the tests with same options defined in my package.json and get the same results when I run in command line (npm run test)

Actual Behavior

When I start Jest runner, it finds some errors because the tests are run in parallel (not with --runInBand)


The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

awaiting response

Most helpful comment

Thank you. It's working now as expected.

In settings, I added:

jest.pathToJest = node_modules/.bin/jest --runInBand

All 3 comments

if you expect this plugin to run npm run test but haven't configured the jest.pathToJest accordingly, chances are it is not using it... You can check it yourself by turning on the debug mode to see the exact command the runner is using.

Thank you. It's working now as expected.

In settings, I added:

jest.pathToJest = node_modules/.bin/jest --runInBand

great!

Was this page helpful?
0 / 5 - 0 ratings