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

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

Closed
mysticflute opened this issue May 22, 2019 · 6 comments · Fixed by #8751
Closed

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

mysticflute opened this issue May 22, 2019 · 6 comments · Fixed by #8751

Comments

@mysticflute
Copy link

🐛 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 
@ChrisLahaye
Copy link

Is there any plan to support this?

@xzyfer
Copy link

xzyfer commented Jun 28, 2019

This would address the needs of #2235 which is a real pain point

@SimenB
Copy link
Member

SimenB commented Jun 28, 2019

Is there any plan to support this?

Sure, PR welcome 🙂

@Mark1626
Copy link
Contributor

@SimenB
Copy link
Member

SimenB commented Jul 25, 2019

Go for it! And yeah, that sounds like the correct way of doing it 🙂

@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, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants