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

chore(gatsby): Add yarn shortcuts for running tests with devtools #20832

Merged
merged 1 commit into from
Jan 24, 2020

Conversation

pvdz
Copy link
Contributor

@pvdz pvdz commented Jan 24, 2020

Adds two yarn/npm run aliases;

  • yarn jest:inspect will run jest through node --inspect
  • yarn jest:inspect-brk will run jest through node --inspect-brk

The difference is that one (--inspect-brk) will wait for the devtools to connect and pause at the start. This one requires you to explicitly press the start button before the code starts running (once hooked up). The other one (--inspect) will start running immediately after connecting to devtools.

(For anyone looking at this; The way you use this is to go to chrome/chromium and open the pseudo-url about:inspect. In there click the "open dedicated window for node" link (see screencap). Once that window is open, node --inspect and node --inspect-brk will automatically start debug sessions in that devtools popup. To debug a Gatsby test you would run yarn jest:inspect some/feat.js -t "test case". )

image

@pvdz pvdz requested a review from a team as a code owner January 24, 2020 09:18
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

LGTM

@wardpeet wardpeet merged commit 302c5d0 into master Jan 24, 2020
@wardpeet wardpeet deleted the jest-inspect branch January 24, 2020 12:52
@muescha
Copy link
Contributor

muescha commented Jan 30, 2020

i would like to see the small "qickstart" also somewhere in the docs...

@muescha
Copy link
Contributor

muescha commented Jan 30, 2020

ah - found it here with examples for gatsby build - not for tests:
https://www.gatsbyjs.org/docs/debugging-the-build-process/#chrome-devtools-for-node

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.

3 participants