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

[test runner] Restore TEST_GREP support (jest's -t parameter) #14170

Merged
merged 1 commit into from Jan 18, 2022

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Jan 17, 2022

Q                       A
License MIT

Tested manually running yarn jest babel-parser/test/index -t placeholders and TEST_GREP=placeholders TEST_ONLY=babel-parser make test-only.

The logic is copied from https://github.com/facebook/jest/blob/3a85065fe5604655e1337ffc1631f9999722c821/packages/jest-circus/src/run.ts#L105 and https://github.com/facebook/jest/blob/e0b33b74b5afd738edc183858b5c34053cfc26dd/packages/jest-circus/src/eventHandler.ts#L237.

Thanks @pzuraq and @tolmasky for noticing that this stopped working! 😅

@babel-bot
Copy link
Collaborator

babel-bot commented Jan 17, 2022

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

@tolmasky
Copy link
Contributor

Nice! Thanks @nicolo-ribaudo

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

Another feature request for jest-light-runner: run in main thread when --runInBand is provided, mostly used for debugging.

@nicolo-ribaudo
Copy link
Member Author

nicolo-ribaudo commented Jan 17, 2022

Do you still wish you had --runInBand? With the lighter wrappers that we use know, I have never felt the need for it.

@JLHwung
Copy link
Contributor

JLHwung commented Jan 17, 2022

Do you still wish you had --runInBand? With the lighter wrappers that we use know, I have never felt the need for it.

--runInBand is used for hooking debugger. Otherwise we have to pass --inspect-brk to each worker and figure out which worker is running the interested test. Currently I manually revise jest.config.js when I want to open a debugger.

@nicolo-ribaudo
Copy link
Member Author

Oh ok, right. I didn't think about it because I take a different approach: using vscode (I don't remember which editor you use), I put a breakpoint in the test file (it works well because they are not compiled, but they are executed natively), and then I run that file with this .vscode/launch.json:

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "pwa-node",
			"request": "launch",
			"name": "Test current file",
			"program": "${workspaceFolder}/node_modules/.bin/jest",
			"args": ["${relativeFile}"]
		},
		{
			"type": "pwa-node",
			"request": "launch",
			"name": "Test current file (Babel 8)",
			"program": "${workspaceFolder}/node_modules/.bin/jest",
			"args": ["${relativeFile}"],
			"env": { "BABEL_8_BREAKING": "true" }
		}
	]
}

@nicolo-ribaudo nicolo-ribaudo merged commit e1708ff into babel:main Jan 18, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the jest-t branch January 18, 2022 12:05
@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 Apr 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: tests outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants