Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ function invalidArgTypeHelper(input) {
return ` Received type ${typeof input} (${inspected})`;
}

module.exports = {
const common = {
allowGlobals,
buildType,
canCreateSymLink,
Expand Down Expand Up @@ -717,7 +717,7 @@ module.exports = {
skipIfReportDisabled,
skipIfWorker,

get enoughTestCPU() {
get enoughTestCpu() {
const cpus = require('os').cpus();
return Array.isArray(cpus) && (cpus.length > 1 || cpus[0].speed > 999);
},
Expand Down Expand Up @@ -815,3 +815,12 @@ module.exports = {
}

};

const validProperties = new Set(Object.keys(common));
module.exports = new Proxy(common, {
get(obj, prop) {
if (!validProperties.has(prop))
throw new Error(`Using invalid common property: '${prop}'`);
return obj[prop];
}
});
2 changes: 0 additions & 2 deletions test/common/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const {
mustNotCall,
printSkipMessage,
skip,
ArrayStream,
nodeProcessAborted,
isAlive,
expectWarning,
Expand Down Expand Up @@ -83,7 +82,6 @@ export {
mustNotCall,
printSkipMessage,
skip,
ArrayStream,
nodeProcessAborted,
isAlive,
expectWarning,
Expand Down