Run request data tests with Wasm enabled too (#3829)

This commit is contained in:
Manish Jethani 2021-08-16 18:52:35 +05:30 committed by GitHub
parent 36377320ae
commit ffb4fe9b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 8 deletions

View File

@ -59,12 +59,14 @@ describe('Request data', () => {
texttrack: 'other', texttrack: 'other',
}; };
let enableWASM = null;
let engine = null; let engine = null;
before(async () => { before(async () => {
const { StaticNetFilteringEngine } = await import('../index.js'); const module = await import('../index.js');
enableWASM = module.enableWASM;
engine = await StaticNetFilteringEngine.create(); engine = await module.StaticNetFilteringEngine.create();
await engine.useLists([ await engine.useLists([
read('./data/assets/ublock/badware.txt') read('./data/assets/ublock/badware.txt')
@ -92,6 +94,16 @@ describe('Request data', () => {
]); ]);
}); });
// False must go first:
// https://github.com/gorhill/uBlock/pull/3828#issuecomment-899470383
for ( let wasm of [ false, true ] ) {
context(`${wasm ? 'Wasm on' : 'Wasm off'}`, () => {
before(async () => {
if ( wasm ) {
assert(await enableWASM());
}
});
for ( let i = 0; i < requests.length; i++ ) { for ( let i = 0; i < requests.length; i++ ) {
const { url, frameUrl, cpt } = requests[i]; const { url, frameUrl, cpt } = requests[i];
const request = { url, originURL: frameUrl, type: typeMap[cpt] }; const request = { url, originURL: frameUrl, type: typeMap[cpt] };
@ -103,3 +115,5 @@ describe('Request data', () => {
}); });
} }
}); });
}
});