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

fix(testing): fix passing extra args to Jest cli #27704

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mararok
Copy link

@Mararok Mararok commented Aug 29, 2024

Small fix for using jest-runner-groups(https://www.npmjs.com/package/jest-runner-groups) with Nx.

Current Behavior

When running jest executor with extra group argument like:

nx run app-nebula-explorer-api:test --group=unit

jest-runner-groups runs all tests, not only from selected group.

From my investigation, jest-runner-groups using process.argv to extract --group args
https://github.com/eugene-manuilov/jest-runner-groups/blob/3c9d3cf4cb3e595bdea733100f2bdc8d64f871d7/index.js#L57
and process.argv passed to runner contains:

[
 'M:\\programs\\nodejs\\22\\node.exe',
 'M:\\projects\\someproject\\node_modules\\.pnpm\\[email protected]_@[email protected]_@[email protected]_\\node_modules\\nx\\bin\\run-executor.js'   
]

Expected Behavior

Running jest executor with jest-runner-groups runner and --group args should run only tests from group.

PR changes summary

I implemented fix as generic and any extra arg will be added to process.argv .

@Mararok Mararok requested a review from a team as a code owner August 29, 2024 21:14
@Mararok Mararok requested a review from FrozenPandaz August 29, 2024 21:14
Copy link

vercel bot commented Aug 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Dec 13, 2024 9:54pm

Copy link

nx-cloud bot commented Aug 29, 2024

Your CI Pipeline Execution ↗ for commit f0f75a5 ⏳ is in progress.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 35m, 4s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 1m, 2s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 0s View ↗
nx-cloud record -- nx format:check --base=4cd64... ✅ Succeeded 18s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 17s View ↗
nx documentation --no-dte ✅ Succeeded 43s View ↗

Last updated at 2024-12-13 22:34:22UTC

Sent with 💌 from NxCloud.

@Mararok Mararok force-pushed the fix-testing-jest-extra-args-passing branch 4 times, most recently from 40d2e86 to 56e5336 Compare September 3, 2024 21:06
@Mararok Mararok force-pushed the fix-testing-jest-extra-args-passing branch 4 times, most recently from cb63dad to 039a471 Compare September 14, 2024 08:25
@Mararok Mararok force-pushed the fix-testing-jest-extra-args-passing branch 4 times, most recently from 46d3fac to 3f28c91 Compare September 26, 2024 15:40
@Mararok Mararok force-pushed the fix-testing-jest-extra-args-passing branch 2 times, most recently from ec6b727 to aea11b5 Compare October 4, 2024 17:59
@Mararok Mararok force-pushed the fix-testing-jest-extra-args-passing branch 2 times, most recently from 1e3f934 to ef55f09 Compare October 15, 2024 16:31
@Mararok Mararok force-pushed the fix-testing-jest-extra-args-passing branch from ef55f09 to d3015c8 Compare December 5, 2024 17:04
@Mararok Mararok force-pushed the fix-testing-jest-extra-args-passing branch from d3015c8 to f0f75a5 Compare December 13, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants