Skip to content

Fix test debugging instructions for contributors#14486

Merged
nicolo-ribaudo merged 1 commit intobabel:mainfrom
conartist6:debuggable-tests
Jul 7, 2022
Merged

Fix test debugging instructions for contributors#14486
nicolo-ribaudo merged 1 commit intobabel:mainfrom
conartist6:debuggable-tests

Conversation

@conartist6
Copy link
Copy Markdown
Contributor

@conartist6 conartist6 commented Apr 23, 2022

Q                       A
Fixed Issues? Fixed head banging on table
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? No
Documentation PR Link None
Any Dependency Changes? No
License MIT

Stop this dang lite runner from breaking all my breakpoints! Tell other developers how to ensure it does not happen to them! This ate my whole afternoon! Ugh.

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Apr 23, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52442/

jest.config.js Outdated
Comment on lines +14 to +15
supportsESMAndJestLightRunner && !isDebug
? "jest-light-runner"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I use jest-light-runner when debugging without problems 🤔 Why do we need to disable it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can't hit any debuggers inside test setup or tests when it's turned on. I don't know why that is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What OS and node version are you using?

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo Apr 24, 2022

Choose a reason for hiding this comment

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

Oh, looking at nodejs/node#26609 it seems like it doesn't work with some debuggers, such as Chrome's (I'm using the VS Code debugger).

You may add a comment that if your debugger does not support worker_threads, you can edit the jest config to use the old runner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yep, I'm using chrome's. I don't like telling people to change configs. If you're not comfortable with keying this on TEST_DEBUG maybe it could have its own environment variable like TEST_NO_WORKER_THREADS which contributing could mention?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nah, I'll just implement same-thread support in the light runner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Jest uses same-thread execution when it determines that only one file matches testNamePattern. Will you use that same heuristic?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, for simplicity you will always have to specify the --runInBand option (which is implied by TEST_DEBUG).

Could you try if nicolo-ribaudo/jest-light-runner#20 works for you? You only have to replace jest-light-runner's version in package.json with nicolo-ribaudo/jest-light-runner#run-in-band.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It works I hit my breakpoint.

@conartist6
Copy link
Copy Markdown
Contributor Author

OK I've updated the PR. It now brings in your new version of jest-light-runner and provides all the relevant information in CONTRIBUTING.md

@nicolo-ribaudo nicolo-ribaudo merged commit cc67a6e into babel:main Jul 7, 2022
@nicolo-ribaudo nicolo-ribaudo added the PR: Docs 📝 A type of pull request used for our changelog categories label Jul 7, 2022
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 7, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Docs 📝 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants