Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: "False expression: Non-string value passed to ts.resolveTypeReferenceDirective" error when using typescript config file with typescript 4.7 beta #12655

Closed
DetachHead opened this issue Apr 9, 2022 · 4 comments

Comments

@DetachHead
Copy link

DetachHead commented Apr 9, 2022

Version

28.0.0-alpha.8

Steps to reproduce

  1. create jest.config.ts file
    const config = {}
    export default config
  2. run the jest command

Expected behavior

tests run

Actual behavior

> jest

Error: Jest: Failed to parse the TypeScript config file C:\Users\amogus\IdeaProjects\ts-helpers\jest.config.ts
  Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.
    at readConfigFileAndSetRootDir (C:\Users\amogus\IdeaProjects\ts-helpers\node_modules\@jest\core\node_modules\jest-config\build\readConfigFileAndSetRootDir.js:136:13)
    at async readConfig (C:\Users\amogus\IdeaProjects\ts-helpers\node_modules\@jest\core\node_modules\jest-config\build\index.js:216:18)
    at async readConfigs (C:\Users\amogus\IdeaProjects\ts-helpers\node_modules\@jest\core\node_modules\jest-config\build\index.js:404:26)
    at async runCLI (C:\Users\amogus\IdeaProjects\ts-helpers\node_modules\@jest\core\build\cli\index.js:132:59)
    at async Object.run (C:\Users\amogus\IdeaProjects\ts-helpers\node_modules\jest-cli\build\cli\index.js:155:37)

Additional context

typescript version

4.7.0-beta

workaround

compile the jest.config.ts file first. i updated my test script in package.json like so:

{
    "scripts": {
        "test": "tsc jest.config.ts && jest --config jest.config.js"
    }
}

Environment

System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
  Binaries:
    Node: 16.11.1 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^28.0.0-alpha.8 => 28.0.0-alpha.8
@DetachHead DetachHead changed the title [Bug]: "False expression: Non-string value passed to ts.resolveTypeReferenceDirective" error with typescript 4.7 beta [Bug]: "False expression: Non-string value passed to ts.resolveTypeReferenceDirective" error when using typescript config file with typescript 4.7 beta Apr 9, 2022
@SimenB
Copy link
Member

SimenB commented Apr 9, 2022

Sounds like ts-node. @cspotcode?

@cspotcode
Copy link
Contributor

What version of ts-node are you using? We recently fixed an API incompatibility, and I'm wondering if you're using an old version of ts-node.

TypeStrong/ts-node#1647
TypeStrong/ts-node#1648

@DetachHead
Copy link
Author

updating ts-node to 10.7.0 fixed it, thanks!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants