-
Notifications
You must be signed in to change notification settings - Fork 465
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: run interfering tests in their own process #1325
test: run interfering tests in their own process #1325
Conversation
b63f9e7
to
983ebd2
Compare
Jenkins ci run on latest (main) - https://ci.nodejs.org/job/node-test-node-addon-api-new/7647/ jenkins ci run on earliest (16.x) - https://ci.nodejs.org/job/node-test-node-addon-api-new/7648/ |
test/addon_data.cc
Outdated
// 0. A boolean named "verbose" is stored in the instance data. The constructor | ||
// for JS `VerboseIndicator` instances is also stored in the instance data. | ||
// 0. The constructor for JS `VerboseIndicator` instances, which have a private | ||
// member named "verbose" is stored in the instance data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// member named "verbose" is stored in the instance data. | |
// member named "verbose" stored in the instance data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to say that the constructor is stored on the instance data, so rather than remove the word "is", I need to put a comma in front of it.
test/common/index.js
Outdated
// Capture the exit code and signal. | ||
child | ||
.on('exit', (code, signal) => maybeResolve({ code, signal })) | ||
.on('close', () => maybeResolve()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'close'
event is always emitted after the 'exit'
event (https://nodejs.org/api/child_process.html#event-close). So this can be simplified as:
.on('close', () => maybeResolve()); | |
.on('close', (code, signal) => resolve({ code, signal })); |
Tests such as addon and addon_data both use SetInstanceData. Thus, they overwrite each other's instance data. We change them both to run in a child process such that they do not call SetInstanceData on init, but rather they return a JS function on init which, when called, produces the actual binding which needs SetInstanceData. We also introduce a utility function for launching a test in its own child process for the purpose of running tests that would otherwise interfere with each other.
1de5ef4
to
38061b3
Compare
The job for 21 seems buggy: |
Tests such as addon and addon_data both use SetInstanceData. Thus, they overwrite each other's instance data. We change them both to run in a child process such that they do not call SetInstanceData on init, but rather they return a JS function on init which, when called, produces the actual binding which needs SetInstanceData. We also introduce a utility function for launching a test in its own child process for the purpose of running tests that would otherwise interfere with each other. Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com> PR-URL: #1325 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Landed in 414be9e. |
Tests such as addon and addon_data both use SetInstanceData. Thus, they overwrite each other's instance data. We change them both to run in a child process such that they do not call SetInstanceData on init, but rather they return a JS function on init which, when called, produces the actual binding which needs SetInstanceData. We also introduce a utility function for launching a test in its own child process for the purpose of running tests that would otherwise interfere with each other. Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com> PR-URL: nodejs/node-addon-api#1325 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Tests such as addon and addon_data both use SetInstanceData. Thus, they overwrite each other's instance data. We change them both to run in a child process such that they do not call SetInstanceData on init, but rather they return a JS function on init which, when called, produces the actual binding which needs SetInstanceData.
We also introduce a utility function for launching a test in its own child process for the purpose of running tests that would otherwise interfere with each other.