Coder Social home page Coder Social logo

Comments (5)

iPlexor avatar iPlexor commented on September 14, 2024

Just throwing in my Jest config, I don't know Jest well enough to know if this is good/bad/invalid or otherwise. But obviously, it might well be something here causing the issue. Unfortunatly, I don't know how to strip it down to a minimal config, but I'll gladly test anything if it helps.

"jest": {
"globals": {
"ts-jest": {
"useBabelrc": false
}
},
"verbose": true,
"collectCoverage": true,
"collectCoverageFrom": [
"ClientApp//*.tsx",
"ClientApp/
/*.ts"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"/tests/common/",
"/ClientApp/typings/",
"/ClientApp/boot.tsx",
"/ClientApp/appstate.tsx",
"/ClientApp/routes.tsx",
],
"transform": {
"^.+\.tsx?$": "ts-jest",
"^.+\.ts?$": "ts-jest"
},
"testRegex": "((\.|/)(test|spec))\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"moduleNameMapper": {
"\.(css|scss)$": "/mocks/styleMock.js"
},
"modulePathIgnorePatterns": [],
"setupFiles": [
"/tests/setup.js"
]
}

from vscode-jest-runner.

firsttris avatar firsttris commented on September 14, 2024

Hey @iPlexor

you do not even have to select the text you can just right click between - it('clicksomewherehere') (also works for describe)

what the addon basically does is it runs "jest -t testNamePattern".

--testNamePattern, -t
Run only tests with a name that matches the regex pattern. [string]

i tested with an project where some tests fail:

jest
=>
Test Suites: 6 failed, 7 passed, 13 total
Tests: 19 failed, 104 passed, 123 total

jest -t 'ComplainCollection Test'
=>
PASS packages/server/src/collections/ComplainCollection.test.ts

Test Suites: 12 skipped, 1 passed, 1 of 13 total
Tests: 122 skipped, 1 passed, 123 total
Snapshots: 0 total
Time: 3.678s
Ran all test suites with tests matching "ComplainCollection Test".

from vscode-jest-runner.

firsttris avatar firsttris commented on September 14, 2024

//jest.config.js

module.exports = {
"moduleDirectories": [
"node_modules",
"packages/common",
"packages/app/src"
],
"globals": {
"ts-jest": {
"tsConfigFile": "tsconfig.json"
}
},
"clearMocks": true,
"resetMocks": true,
"collectCoverageFrom": [
"/server/src/",
"/app/src/actions/",
"/app/src/reducers/"
],
"testRegex": "(/tests/.*|\.(test|spec))\.(ts|tsx|js)$",
"setupFiles": [
"/jest/shim.js",
"/jest/setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/dist/",
"/coverage/",
"/webpack/"
],
"transformIgnorePatterns": [
"/node_modules/",
"/dist/",
"/coverage/",
"/webpack/"
],
"watchPathIgnorePatterns": [
"/node_modules/",
"/dist/",
"/coverage/",
"/webpack/"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jest"
],
"moduleNameMapper": {
"\.(css|less)$": "identity-obj-proxy"
},
"transform": {
"\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/jest/fileTransformer.js",
"^.+\.(ts|tsx)$": "/node_modules/ts-jest/preprocessor.js"
}
}

from vscode-jest-runner.

iPlexor avatar iPlexor commented on September 14, 2024

Thanks for the reply and for creating the extension. 👍

I understand how it's asking node to execute jest with the -t 'testNamePattern' and I raised a seperate issue as I realised why I had to select the test name now.

I think the test suites which fail only fail because they have no tests matching the testNamePattern to execute. The suites do contain tests, but none that match the test name provided. So unless the extension is somehow causing those empty suites to run I think the issue must be with Jest itself not realising it can skip the empty suites and reporting them as failed.

from vscode-jest-runner.

firsttris avatar firsttris commented on September 14, 2024

please reopen if issue still exists

from vscode-jest-runner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.