-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
tests: use workers, Mocha node api instead of calling the CLI #14215
Conversation
import {Connection} from '../../gather/connections/connection.js'; | ||
import {fnAny, mockCommands} from '../test-utils.js'; | ||
|
||
const {createMockSendCommandFn} = mockCommands; | ||
|
||
// Some imports needs to be done dynamically, so that their dependencies will be mocked. |
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 was 100% unnecessary, and actually triggers a bug in testdouble I'm in the middle of fixing
|
||
for (const test of testsToRunIsolated) { | ||
console.log(`Running test in isolation: ${test}`); | ||
const worker = new Worker(new URL(import.meta.url), { |
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.
Why does this need a new URL
?
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 should make the annoyances of Windows shell usage go away.
Also a first step for injecting our own "setup" scripts before certain tests, to make mocking ES modules simpler to write / less error prone. That requires full control on when modules are evaluated, which this PR gives us.