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: reduce flakiness by taking control of environment #710

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

Conversation

LewisCowlesMotive
Copy link

I use vs code with auto-attach, which creates data in STDERR This controls the ENV passed through to child-process Technically I think it improves the test:

Before

test/process-exit.test.js ............................. 2/3
  log with rotating file stream will terminate
  not ok should be equal
    --- wanted                                                                       
    +++ found                                                                        
    +Debugger listening on ws://127.0.0.1:64184/64dcdc5d-8cbd-407a-aed4-32c4b033d814 
    +For help, see: https://nodejs.org/en/docs/inspector                             
    +Debugger attached.                                                              
    +Waiting for the debugger to disconnect...                                       
    compare: '==='
    at:
      line: 23
      column: 15
      file: test/process-exit.test.js
    stack: |
      test/process-exit.test.js:23:15
      ChildProcess.exithandler (node:child_process:390:7)
      ChildProcess.emit (node:events:527:28)
      maybeClose (node:internal/child_process:1092:16)
      Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
    source: |
      t.equal(stderr, '');

After

test/process-exit.test.js ...Waiting for the debugger to disconnect...
Debugger listening on ws://127.0.0.1:64396/e1e9cf0b-2827-4ccb-b2be-b7c848953d3d
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
test/process-exit.test.js ............................. 3/3

So technically what is happening is that the child process was receiving some ENV which told it to debug. I initially tried setting LOG_LEVEL=fatal, without passing anything from process.env; this was a mistake, as process.env.PATH is needed (at least on my machine) to use nodejs. So with that sent in, and a bit of pokery to get npm run check passing, this should meet standards.

I use vs code with auto-attach, which creates data in STDERR
This controls the ENV passed through to child-process
Technically I think it improves the test
@LewisCowlesMotive
Copy link
Author

LewisCowlesMotive commented Apr 22, 2023

Question?

Shouldn't all the child processes in tests follow suit here?

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.

None yet

1 participant