diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 998e394dd2051d..90bc54927f3de0 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -442,8 +442,10 @@ module.exports = { getMessage, SystemError, codes, - // These are exported only to facilitate testing. + // This is exported only to facilitate testing. E, + // This allows us to tell the type of the errors without using + // instanceof, which is necessary in WPT harness. get useOriginalName() { return useOriginalName; }, set useOriginalName(value) { useOriginalName = value; } }; diff --git a/test/parallel/test-internal-error-original-names.js b/test/parallel/test-internal-error-original-names.js index 70ea3e9d402469..195e39b199cd4c 100644 --- a/test/parallel/test-internal-error-original-names.js +++ b/test/parallel/test-internal-error-original-names.js @@ -2,6 +2,11 @@ 'use strict'; +// This tests `internal/errors.useOriginalName` +// This testing feature is needed to allows us to assert the types of +// errors without using instanceof, which is necessary in WPT harness. +// Refs: https://github.com/nodejs/node/pull/22556 + require('../common'); const assert = require('assert'); const errors = require('internal/errors');