mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 13:09:26 +00:00
Switch back to third party fetch lib for all node versions (#2961)
As discussed in https://github.com/MichMich/MagicMirror/pull/2952 Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const jsdom = require("jsdom");
|
||||
const corefetch = require("fetch");
|
||||
|
||||
exports.startApplication = async (configFilename, exec) => {
|
||||
jest.resetModules();
|
||||
@@ -82,8 +83,13 @@ exports.waitForAllElements = (selector) => {
|
||||
});
|
||||
};
|
||||
|
||||
// When native fetch is used keep-alive is set which causes issues with tests that should not share the connection, fall back to use the older one for now...
|
||||
exports.fetch = require("node-fetch");
|
||||
exports.fetch = (url) => {
|
||||
return new Promise((resolve) => {
|
||||
corefetch(url).then((res) => {
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.testMatch = async (element, regex) => {
|
||||
const elem = await this.waitForElement(element);
|
||||
|
Reference in New Issue
Block a user