-
Notifications
You must be signed in to change notification settings - Fork 1
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] Fix open handles in unit tests #117
[test] Fix open handles in unit tests #117
Conversation
@@ -1,6 +1,6 @@ | |||
module.exports = { | |||
clearMocks: true, | |||
moduleFileExtensions: ['js', 'ts'], | |||
moduleFileExtensions: ['js', 'ts', 'node'], |
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.
This addition solves this issue. Found the solution here: jestjs/jest#1694 (comment)
const task = await new MockTestRunner().LoadAsync(file) | ||
await task.runAsync(nodeVersion) |
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.
This now has to be async, otherwise this line will do an infinite loop. See this CI, that I had to cancel.
// Warnings usually come from `mockery`, and can be useful to spot mocking issues. | ||
// Warnings can be useful to spot mocking issues. | ||
// For example, "Replacing existing mock for module: azure-pipelines-task-lib/task" means | ||
// that we tried to mock `azure-pipelines-task-lib/task`, which is already mocked | ||
// by `azure-pipelines-task-lib/mock-run`. So our mock would be overwritten. |
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.
They removed mockery
(microsoft/azure-pipelines-task-lib#968), and Replacing existing mock for module
can still be logged, so I updated the comment.
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.
👍 thanks for handling this
This PR will fix this issue:
This is caused by
azure-pipelines-task-lib
, which used to usesync-request
(a way to synchronously make a request, which they use to download Node.js before running the unit tests).This
sync-request
package is known for leaving orphan processes (ForbesLindesay/sync-request#137) at import time and it recently had some vulnerabilities, which led Microsoft to remove this dependency (microsoft/azure-pipelines-task-lib#932), hence the need to bumpazure-pipelines-task-lib
: 07464dd