Jest issue
whoisdominic opened this issue · 3 comments
whoisdominic commented
jsynowiec commented
Please read this first. If you have problems with Jest, check the Jest and the ts-jest transformer docs. Also, you can check out one of the earlier tags if you do not want ESM and keep using CommonJS instead.
Regarding chalk
, please read their v5 release notes - it mentions that you should probably stay on v4 in this case.
The following code works fine when added to the unit test and use chalk@v4
.
import * as chalk from 'chalk';
console.log(chalk.bgCyan('hello'));
npm run test
> node-typescript-boilerplate@0.0.0 test
> jest --coverage
console.log
hello
danwt commented
Did you get it solved @whoisdominic?
elliotsayes commented
@danwt
tsconfig.json
:
{
"compilerOptions": {
...
"esModuleInterop": true,
...
}
}
Fixes most of the annoying BS for me.
@jsynowiec Really not sure why this isn't the default. No one wants to waste time reading 100 pages of documentation to understand what is going on...