Skip to content

Conversation

@Cammisuli
Copy link
Member

@Cammisuli Cammisuli commented Jun 23, 2020

Completed:

  • ast util to update the jest.config.js file.
    There's a limitation that the config updater will only work if the jest.config.js follows this format:
module.exports = {
 // jest configuration
}
  • add migration for jest.config.js
  • Change jest project template to include setupFilesAfterEnv and other necessary ones

Current Behavior

The jest builder automatically populates the jest config with some properties that should be in the config file from the start. This causes issues when trying to run the Jest tests in an IDE environment, because they do not understand how nx builders work.

Expected Behavior

The jest.config.js file should contain the nessecesary properties needed to be able to run tests in IDEs.

Related Issue(s)

Fixes 747 (I was hoping that this would fix vscode issues, but there's no extension currently that supports multiple jest configs. The ones I found usually expected one at the root. Perhaps we can create one or update Nx Console to support Jest runs in vscode 🤔 )
Fixes #2314

@Cammisuli Cammisuli changed the title WIP: feat(testing): add setupEnv and other configs to project's jest config file WIP: feat(testing): add setupFilesAfterEnv and other configs to project's jest config file Jun 23, 2020
@Cammisuli Cammisuli force-pushed the update-jest-configs branch from 58f3525 to a451a56 Compare June 24, 2020 12:31
@levani132
Copy link

Will they ever merge this? I think this is kind of important.

@Cammisuli
Copy link
Member Author

@levani132 yea, that's the plan. I'm hoping to get this in sometime this week 😄

@Cammisuli Cammisuli self-assigned this Jun 29, 2020
@Cammisuli Cammisuli force-pushed the update-jest-configs branch from a451a56 to 8924ca9 Compare July 3, 2020 12:46
@Cammisuli Cammisuli force-pushed the update-jest-configs branch from 0ec71de to 498b002 Compare July 3, 2020 20:19
@Cammisuli Cammisuli marked this pull request as ready for review July 4, 2020 23:35
…tests using the setupfile rather than builder
@Cammisuli Cammisuli marked this pull request as draft July 5, 2020 01:14
@Cammisuli Cammisuli marked this pull request as ready for review July 7, 2020 12:33
@Cammisuli Cammisuli changed the title WIP: feat(testing): add setupFilesAfterEnv and other configs to project's jest config file feat(testing): add setupFilesAfterEnv and other configs to project's jest config file Jul 7, 2020
@Cammisuli Cammisuli force-pushed the update-jest-configs branch from 684d90f to ba2e88b Compare July 10, 2020 21:39
@Cammisuli Cammisuli requested a review from FrozenPandaz July 12, 2020 11:55
@Cammisuli
Copy link
Member Author

@FrozenPandaz this should be ready to merge now. I updated the migration to run on beta.2 as well.

@FrozenPandaz FrozenPandaz merged commit 3b8a10f into nrwl:master Jul 13, 2020
Doginal pushed a commit to Doginal/nx that referenced this pull request Nov 25, 2020
… jest config file (nrwl#3224)

* feat(testing): add util to update jest configs.

* feat(testing): place configurations in jest config file rather than just the builder

* feat(testing): create migration and unit tests

* feat(testing): fix jest template

* feat(testing): fix jest template to correct unit tests

* feat(testing): include globals.ts-jest for all non babel configs

* feat(testing): include globals.ts-jest for node e2e

* feat(testing): fix migration to run properly. Also check for angular tests using the setupfile rather than builder

* feat(testing): clean up jest config functions and fix errors with some migrations

* feat(testing): add new line to package.json

* feat(testing): update object check to actually check for undefined

* chore(testing): loop through all project targets as well as targets

* chore(testing): update migration to be 10.0.0-beta.2
@Cammisuli Cammisuli deleted the update-jest-configs branch January 29, 2021 15:49
@github-actions
Copy link
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot run Jest tests from Webstorm

3 participants