I’ve recently started writing tests using TypeScript and Jest, but I’m running into an issue where the tests are being executed twice – once for the TS files and then again for the compiled JS files.
While the TypeScript tests are passing without any issues, the JavaScript tests are failing.
yarn run v1.5.1
$ jest
PASS src/__tests__/some.test.ts (7.955s)
● Console
console.log src/lib/google-analytics/ga-api.ts:75
Success!!
console.log src/__tests__/some.test.ts:42
{ reports: { batchGet: [Function: batchGet] } }
FAIL dist/__tests__/some.test.js
● Console
console.log dist/lib/google-analytics/ga-api.js:64
Reject
● it gets a full google analytics report
No key or keyFile set.
... (Error stack trace details)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 9.516s
Ran all test suites.
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c jest
Directory: /Users/carlosbernal/Documents/Grability/DataScience/ga-downloader
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/carlosbernal/Documents/Grability/DataScience/ga-downloader/yarn-error.log".
info Visit https://yarnpg.com/en/docs/cli/run for documentation about this command.
Is this behavior normal with ts-jest or am I overlooking some additional configuration settings?