Closed ramaghanta closed 3 years ago
Could you please provide:
tsconfig.json
(and any .spec.json
, overrides etc. that may be used for tests), andjest
config?@smcenlly thank you for the quick response. Here is my tsconfig.json.
{
"compilerOptions": {
"module": "commonjs",
"target": "es2019",
"lib": ["esnext", "dom"],
"sourceMap": true,
"outDir": "build",
"declaration": true,
"removeComments": false,
"rootDir": "src",
"noLib": false,
"noEmitOnError": false,
"skipLibCheck": true,
"strict": true,
"preserveConstEnums": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"alwaysStrict": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"noUncheckedIndexedAccess": true
},
"exclude": [
"node_modules",
"build",
"dist"
]
}
I'm using the Automatic Configuration for running wallaby, but for Jest command line I'm using
"jest": {
"collectCoverage": true,
"preset": "ts-jest",
"testEnvironment": "node",
"setupFiles": [
"<rootDir>/node_modules/dotenv/config.js"
],
"testPathIgnorePatterns": [
"<rootDir>/build/",
"<rootDir>/node_modules/",
"<rootDir>/src/api/v1/util.test.ts"
],
"testTimeout": 120000
}
@smcenlly I noticed https://github.com/wallabyjs/public/issues/2661, but for VSCode. Could these be related? And some of my tests take longer than jest's default 5000ms. Could that be the reason? If so, I'm guessing I cannot use the automatic wallaby configuration and should have a wallaby configuration with an explicit jest timeout setting?
@smcenlly I noticed #2661, but for VSCode. Could these be related?
No - these aren't related.
I'm taking a look at the moment, will reply when I have an update (or else require more info).
It seems to be working for us with your configuration and sample TypeScript files. Would you mind trying the sample repo that we created to see if it works for you?
In a temp directory:
git clone https://github.com/wallabyjs/wallaby-2666
cd wallaby-2666
npm install
src/api/v1/payment-request-file-put.spec.ts
and src/api/v1/payment-request-file-put.ts
.If this is working for you but your project isn't, could you try removing your node_modules
folder and re-creating it to see if that helps? If that still doesn't help, could you try to update the sample repo with some of your config/code that we may be missing to try duplicate the problem?
Would you also mind sharing a screenshot of where the coverage indicators are not appearing for you?
BTW: the Some long running code has been detected
message is simply a warning and does not indicate an actual error.
Hi @smcenlly, wallaby works like a charm in the sample repo you have created.
We identified the issue to be the presence of the build
folder, which is causing the green indicators not to show up in the .ts
files. Here are some screenshots to show what the issue is:
Spec File:
With build folder:
Without build folder:
About what's creating the build folder for us, it's tsc
from my npm test
script, tsc && jest && npm run prettier && npm run lint
. The workaround for us is to modify the test script as tsc --noEmit && jest && npm run prettier && npm run lint
.
From what I can see in the code, I suspect that:
import { createFixture } from '@checkdigit/serve';
is using your build
folder instead of your src
folder when the build
folder exists. This looks like a private package so unfortunately we can't inspect the code to confirm. If this is the case then you will have to adjust the code there to fix the problem. Maybe switch on process.env.NODE_ENV === 'test'
?
If you are modifying your test script to not emit JavaScript (i.e. tsc --noEmit
) then I assume you will never have a build folder (as you're not building on your local machine) and therefore don't have a Wallaby problem either? Please confirm that everything's working for you now and I'll close this issue.
@smcenlly your suspicion is spot on. Our internal infrastructure module (@checkdigit/serve
) is the culprit here. It's using the build folder if it exists. Modifying my test script to tsc --noEmit
will not create the build folder and hence no issues with running wallaby. Thank you so much for the help. You can close this issue.
Issue description or question
Using wallaby core v1.0.1047 does not show coverage for .ts files whereas jest does
Wallaby diagnostics report