node/test/wpt/test-webcrypto.js
Node.js GitHub Bot a00297480b
test: update WPT resources, interfaces and WebCryptoAPI
PR-URL: https://github.com/nodejs/node/pull/62389
Backport-PR-URL: https://github.com/nodejs/node/pull/63563
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-06-23 01:06:30 +01:00

26 lines
533 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const { WPTRunner } = require('../common/wpt');
const runner = new WPTRunner('WebCryptoAPI');
runner.setInitScript(`
if (Uint8Array.fromHex === undefined) {
Object.defineProperty(Uint8Array, 'fromHex', {
__proto__: null,
configurable: true,
writable: true,
value(hex) {
return new Uint8Array(Buffer.from(hex, 'hex'));
},
});
}
`);
runner.pretendGlobalThisAs('Window');
runner.runJsTests();