-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Labels
Description
Version
^29
Steps to reproduce
- Create TS project with
types: [](no automatic ambient types) - Setup ts-jest according to docs
Expected behavior
Using __dirname in test files should cause a type error because no node ambient types are included
Actual behavior
__dirname does not cause a type error and @types/node is included in the compilation
Debug log
not applicable
Additional context
ts-jest uses bs-logger as a dep which is built with TS3 which automatically injects triple slash references into the declaration files which causes ambient node types to be included. this TS behavior has changed a while ago: see microsoft/TypeScript#57681
ts-jest is the only dep (in my package) that (indirectly) forces inclusion of ambient node types (through bs-logger).
Remediations (that i know of):
ts-jestdrops the dep onbs-loggerbs-loggershould be built with TS5.7+bs-loggershould not reexportnodetypes (https://github.com/huafu/bs-logger/blob/master/src/logger/target.ts#L11 re-exportsnode'sWritableinterface)
edit: i created the ticket here, because my package does not depend on bs-logger, but only ts-jest.
Environment
System:
OS: macOS 26.0.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 22.21.1 - /usr/local/bin/node
Yarn: 1.22.19 - ~/ws/<redacted>/node_modules/.bin/yarn
npm: 10.9.4 - /usr/local/bin/npm
npmPackages:
jest: ^30.2.0 => 30.2.0EFTechnicalPM