mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
test: use global webcrypto for WPT tests
PR-URL: https://github.com/nodejs/node/pull/42236 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
f2676b9ea9
commit
4d70dc7dc2
1 file changed
+1
-40
@@ -9,45 +9,6 @@ const { WPTRunner } = require('../common/wpt');
|
||||
const runner = new WPTRunner('WebCryptoAPI');
|
||||
|
||||
// Set Node.js flags required for the tests.
|
||||
runner.setFlags(['--expose-internals']);
|
||||
|
||||
// Set a script that will be executed in the worker before running the tests.
|
||||
runner.setInitScript(`
|
||||
const {
|
||||
Crypto,
|
||||
SubtleCrypto,
|
||||
crypto,
|
||||
} = require('internal/crypto/webcrypto');
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const { DOMException } = internalBinding('messaging');
|
||||
global.DOMException = DOMException;
|
||||
|
||||
Object.defineProperties(global, {
|
||||
Crypto: {
|
||||
value: Crypto,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
},
|
||||
SubtleCrypto: {
|
||||
value: SubtleCrypto,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
},
|
||||
CryptoKey: {
|
||||
value: crypto.CryptoKey,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
},
|
||||
crypto: {
|
||||
value: crypto,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
},
|
||||
});
|
||||
`);
|
||||
runner.setFlags(['--experimental-global-webcrypto']);
|
||||
|
||||
runner.runJsTests();
|
||||
Reference in new issue
Block a user