Skip to content

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

@DetachHead

Description

@DetachHead

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions