Skip to content

Commit a1ccf07

Browse files
TrottMylesBorins
authored andcommitted
test: make test-os-checked-function work without test harness
Most tests in `test/parallel` work when invoked with `node` rather than `tools/test.py` but not test-os-checked-function because it doesn't load the `common` module initially, which means it won't get re-spawned with the necessary flags (in the Flags: comment, in this case --expose_internals). Now that common delays loading 'os' until it needs to load it, this test can load the common module and it will work from the command line without the test harness. Additionally, we now can remove a comment disabling a lint rule. PR-URL: #30914 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 29f807e commit a1ccf07

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

test/parallel/test-os-checked-function.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* eslint-disable node-core/require-common-first */
21
'use strict';
32
// Flags: --expose_internals
43

4+
const common = require('../common');
55
const { internalBinding } = require('internal/test/binding');
66

77
// Monkey patch the os binding before requiring any other modules, including
@@ -12,7 +12,6 @@ internalBinding('os').getHomeDirectory = function(ctx) {
1212
ctx.message = 'baz';
1313
};
1414

15-
const common = require('../common');
1615
const os = require('os');
1716

1817
common.expectsError(os.homedir, {

0 commit comments

Comments
 (0)