-
Notifications
You must be signed in to change notification settings - Fork 5
Update get-port to v5.1.0 #152
Comments
Looks like the latest version of get-port is now using a At some point they call This is a Node.js specific thing that is not typically available in browser environments. When running the code in Jest, some globals such as |
I see, but I'm not sure that setting the testEnvironment to node is a good choice. Is there maybe another solution for this? |
Yes the test that's failing is
If we look at the following documentation: https://jestjs.io/docs/en/configuration.html#testenvironment-string They have some example code of how to create/extend an environment. We would follow that example but we would extend the I think the overall solution would look something like this: const JSDomEnvironment = require('jest-environment-jsdom');
const lolex = require('lolex');
class JSDomEnvironmentWithNodeTimers extends JSDomEnvironment {
constructor(config, context) {
super(config, context);
this.testPath = context.testPath;
this.docblockPragmas = context.docblockPragmas;
}
async setup() {
await super.setup();
this.clock = lolex.install(); // mocks all the global timers
}
async teardown() {
this.clock.uninstall() // tear down the global timers
await super.teardown();
}
runScript(script) {
return super.runScript(script);
}
}
module.exports = JSDomEnvironmentWithNodeTimers; I'm not 100% sure if it will work but it might be worth trying? |
wdyt? |
@darahayes btw this is a low priority issue, the project is perfectly working with the old version |
The new version of the get-port module has some braking changes that break the tests, we need to investigate these changes and fix them in order to update to the latest version.
#139
The text was updated successfully, but these errors were encountered: