Ts-jest: What should I use instead of __TS_CONFIG__ ?

Created on 18 Sep 2017  路  3Comments  路  Source: kulshekhar/ts-jest

  • Issue

The project readme warns me against using __TS_CONFIG__, but doesn't seem to offer me an alternative:

Warning: Using __TS_CONFIG__ option in globals is deprecated and soon will be removed.

I don't want my build to stop working one day, at least not unless I upgrade a dependency by a major version (is this project using semver? I cannot tell).

  • Expected behavior

I'd like to know:

  • how long I can rely on the current global variable config,
  • what I may do to future-proof my build

Most helpful comment

I originally just misread the documentation. That's why I closed my issue.

All 3 comments

but doesn't seem to offer me an alternative:

The section that contains the warning is quite literally about what you need to do :)

https://github.com/kulshekhar/ts-jest#tsconfig

The __TS_CONFIG__ section contains the typescript configuration. Going forward, that configuration should be in a different file and the tsConfigFile key in the ts-jest section (under globals) should point to this file. You can ignore this if the configuration you want is identical to the main tsconfig.json.

is this project using semver? I cannot tell

https://github.com/kulshekhar/ts-jest#versioning

how long I can rely on the current global variable config,

It'll work in the current version (21.x.x) and won't work from the next version (22.x.x). The warnings in the build have been displayed since sometime during the version 20.x.x.

what I may do to future-proof my build

Put the typescript configuration for testing in a new file and point the
jest > globals > ts-jest > tsConfigFile key in package.json to that file.

I originally just misread the documentation. That's why I closed my issue.

To be fair, this totally confused me too. I created #416 to avoid any future confusion.

Was this page helpful?
0 / 5 - 0 ratings