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

Add test-unit-watch:debug script to package.json #36076

Closed
wants to merge 2 commits into from

Conversation

kamilmielnik
Copy link
Contributor

@kamilmielnik kamilmielnik commented Nov 23, 2023

I needed to debug unit tests today and figured this is a useful little script to have in package.json.

See https://jestjs.io/docs/troubleshooting.

@kamilmielnik kamilmielnik marked this pull request as ready for review November 23, 2023 12:16
@kamilmielnik kamilmielnik added the no-backport Do not backport this PR to any branch label Nov 23, 2023
@kamilmielnik kamilmielnik requested a review from a team November 23, 2023 12:16
@kamilmielnik kamilmielnik requested a review from a team November 23, 2023 15:07
@@ -359,6 +359,7 @@
"test-unit-keep-cljs": "jest --maxWorkers=2",
"test-unit-watch": "yarn test-unit --watch",
"test-unit-watch:cljs": "yarn concurrently -n 'cljs,tests' 'yarn build-watch:cljs' 'yarn test-unit-keep-cljs --watch'",
"test-unit-watch:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --no-cache --watch",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tried it, but I am assuming you can't use just yarn jest because --inspect-brk flag is needed to be passed to node?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have found this though: https://stackoverflow.com/a/48550380
If it works, might be a bit easier to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're on an old version of yarn and the --inspect flag is not available.

We could use NODE_OPTIONS="--inspect" but I don't think it's necessarily easier to understand/read than node --inspect-brk path.

@uladzimirdev
Copy link
Contributor

I'd suggest using vscode debugging instead of node --inspect-brk, it might be useful if you investigate memory issues or some perf issues

@kamilmielnik kamilmielnik requested review from a team and oleggromov November 24, 2023 06:57
@uladzimirdev
Copy link
Contributor

One more IMO: this is a command you'd use in every other project, so alias may be better

alias jest-debug="node --inspect-brk ...

I personally used this command only for debugging performance of the tests

@kamilmielnik
Copy link
Contributor Author

Related Slack discussion.


I honestly didn't think this change is going to cause so much stir.
At this point I believe the most efficient thing to do is to bite the bullet and close the PR.

@kamilmielnik kamilmielnik deleted the chore/add-unit-test-debug-script branch November 28, 2023 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/QueryingComponents
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants