Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138134

Specify the Jest Test Directory in VS Code

$
0
0

I'm using the jest-test-explorer with the test-explorer-ui extensions in VS Code and have a directory unit tests/ and another acceptance tests/. The test explorer sidebar shows and runs the tests in both directories however I would only want to see and run the tests in the unit tests/ directory.

I use the ./node_modules/.bin/jest --coverage 'unit tests/' command from the bash prompt to run the tests in the correct directory but what is the equivalent way to configure jest so that this becomes the default? I have a jest-test.config.js file containing the following:

module.exports = {
    displayName: 'test',
    verbose: true,
    collectCoverage: true,
    coverageThreshold: {
        global: {
            branches: 0,
            functions: 0,
            lines: 0,
            statements: 0
        }
    },
    testMatch: [
        '**/unit\ tests/**/*.js'
    ],
    testPathIgnorePatterns: [
        '/node_modules/',
        '/__tests__/fixtures/',
    ]
}

When I run the command ./node_modules/.bin/jest this still includes the second directory of tests and the sidebar still shows the other tests. How do I configure Jest to only look in the specified directory?


Viewing all articles
Browse latest Browse all 138134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>