mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-22 10:22:51 +01:00
Test in new world (#3822)
This commit is contained in:
parent
bd8cb8d50f
commit
0a11999459
5
platform/nodejs/package-lock.json
generated
5
platform/nodejs/package-lock.json
generated
@ -462,6 +462,11 @@
|
||||
"integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==",
|
||||
"dev": true
|
||||
},
|
||||
"esm-world": {
|
||||
"version": "github:mjethani/esm-world#0e5a77a5c0cb22de28616bba9ed7247dee218fb3",
|
||||
"from": "github:mjethani/esm-world#0e5a77a5c0cb22de28616bba9ed7247dee218fb3",
|
||||
"dev": true
|
||||
},
|
||||
"espree": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
|
||||
|
@ -31,6 +31,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"esm-world": "github:mjethani/esm-world#0e5a77a5c0cb22de28616bba9ed7247dee218fb3",
|
||||
"mocha": "^9.0.3"
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ async function doHNTrie() {
|
||||
}
|
||||
|
||||
async function spawnMocha() {
|
||||
await promisify(spawn)('mocha', [ 'tests' ], { stdio: [ 'inherit', 'inherit', 'inherit' ] });
|
||||
await promisify(spawn)('mocha', [ '--experimental-vm-modules', '--no-warnings', 'tests' ], { stdio: [ 'inherit', 'inherit', 'inherit' ] });
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
@ -24,22 +24,28 @@
|
||||
/******************************************************************************/
|
||||
|
||||
import { strict as assert } from 'assert';
|
||||
import process from 'process';
|
||||
|
||||
import {
|
||||
StaticNetFilteringEngine,
|
||||
} from '../index.js';
|
||||
import { createWorld } from 'esm-world';
|
||||
|
||||
process.on('warning', warning => {
|
||||
// Ignore warnings about experimental features like
|
||||
// --experimental-vm-modules
|
||||
if ( warning.name !== 'ExperimentalWarning' ) {
|
||||
console.warn(warning.stack);
|
||||
}
|
||||
});
|
||||
|
||||
let engine = null;
|
||||
|
||||
describe('SNFE', () => {
|
||||
before(async () => {
|
||||
engine = await StaticNetFilteringEngine.create();
|
||||
});
|
||||
|
||||
describe('Filter loading', () => {
|
||||
beforeEach(async () => {
|
||||
// This is in lieu of a constructor for a non-singleton.
|
||||
await engine.useLists([]);
|
||||
const globals = { URL, setTimeout, clearTimeout };
|
||||
|
||||
const { StaticNetFilteringEngine } = await createWorld('./index.js', { globals });
|
||||
|
||||
engine = await StaticNetFilteringEngine.create();
|
||||
});
|
||||
|
||||
it('should not reject on no lists', async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user