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