Skip to content

allow "testEnvironment" to work together with transform/presets #8479

@mysticflute

Description

@mysticflute

🐛 Bug Report

I think this is similar to #5164. In my jest config I have a custom "testEnvironment" that's written in typescript that I want transformed by ts-jest.

To Reproduce

Sample jest config:

module.exports = {
    testEnvironment: './environment.ts',
    globalSetup: './globalSetup.ts',
    globalTeardown: './globalTeardown.ts',
    preset: 'ts-jest',
};

globalSetup and globalTeardown does work, but testEnvironment doesn't:

    (function (exports, require, module, __filename, __dirname) { import NodeEnvironment from 'jest-environment-node';
                                                                         ^^^^^^^^^^^^^^^
    SyntaxError: Unexpected identifier

Expected behavior

the testEnvironment file is transformed.

Link to repl or repo (highly encouraged)

Please provide either a repl.it demo or a minimal repository on GitHub.

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
  npmPackages:
    jest: ^24.7.1 => 24.8.0 

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