Skip to content

test: reduce flakiness by taking control of environment#710

Open
LewisCowlesMotive wants to merge 1 commit intotrentm:masterfrom
LewisCowlesMotive:fix-flaky-subprocess-test
Open

test: reduce flakiness by taking control of environment#710
LewisCowlesMotive wants to merge 1 commit intotrentm:masterfrom
LewisCowlesMotive:fix-flaky-subprocess-test

Conversation

@LewisCowlesMotive
Copy link
Copy Markdown

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
Copy Markdown
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.

1 participant