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: https://github.com/nodejs/node/pull/30914
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
Rich Trott authored and Beth Griggs committed 2020-02-06 02:48:55 +00:00
1 parent 20c8a0a5ac
commit 0ca80446c4
1 file changed
+1 -2
+1 -2
View File
@@ -1,7 +1,7 @@
/* eslint-disable node-core/require-common-first */
'use strict';
// Flags: --expose_internals
const common = require('../common');
const { internalBinding } = require('internal/test/binding');
// Monkey patch the os binding before requiring any other modules, including
@@ -12,7 +12,6 @@ internalBinding('os').getHomeDirectory = function(ctx) {
ctx.message = 'baz';
};
const common = require('../common');
const os = require('os');
common.expectsError(os.homedir, {