test: fix flaky test-crypto-timing-safe-dqual-benchmarks

Fixes: https://github.com/nodejs/node/issues/38226

PR-URL: https://github.com/nodejs/node/pull/38476
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Ruy Adorno <ruyadorno@github.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rich Trott 2021-04-29 16:48:12 -07:00 committed by James M Snell
parent 40ea8aa364
commit c7ccab31e5
No known key found for this signature in database
GPG Key ID: 7341B15C070877AC
2 changed files with 5 additions and 3 deletions

View File

@ -46,7 +46,6 @@ const {
ObjectGetPrototypeOf, ObjectGetPrototypeOf,
ObjectPreventExtensions, ObjectPreventExtensions,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
Proxy,
ReflectGet, ReflectGet,
ReflectSet, ReflectSet,
SymbolToStringTag, SymbolToStringTag,
@ -108,8 +107,10 @@ const deprecationHandler = {
get(target, key, receiver) { get(target, key, receiver) {
const val = ReflectGet(target, key, receiver); const val = ReflectGet(target, key, receiver);
if (val != null && typeof val === 'object') if (val != null && typeof val === 'object') {
// eslint-disable-next-line node-core/prefer-primordials
return new Proxy(val, deprecationHandler); return new Proxy(val, deprecationHandler);
}
return val; return val;
}, },
@ -119,6 +120,7 @@ const deprecationHandler = {
} }
}; };
// eslint-disable-next-line node-core/prefer-primordials
let processConfig = new Proxy( let processConfig = new Proxy(
JSONParse(nativeModule.config), JSONParse(nativeModule.config),
deprecationHandler); deprecationHandler);

View File

@ -111,7 +111,7 @@ assert(
`timingSafeEqual should not leak information from its execution time (t=${t})` `timingSafeEqual should not leak information from its execution time (t=${t})`
); );
// As a sanity check to make sure the statistical tests are working, run the // As a coherence check to make sure the statistical tests are working, run the
// same benchmarks again, this time with an unsafe comparison function. In this // same benchmarks again, this time with an unsafe comparison function. In this
// case the t-value should be above the threshold. // case the t-value should be above the threshold.
const unsafeCompare = (bufA, bufB) => bufA.equals(bufB); const unsafeCompare = (bufA, bufB) => bufA.equals(bufB);