Skip to content

Commit

Permalink
test: make test-os-checked-function work without test harness
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trott authored and BethGriggs committed Feb 6, 2020
1 parent 20c8a0a commit 0ca8044
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/parallel/test-os-checked-function.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,7 +12,6 @@ internalBinding('os').getHomeDirectory = function(ctx) {
ctx.message = 'baz';
};

const common = require('../common');
const os = require('os');

common.expectsError(os.homedir, {
Expand Down

0 comments on commit 0ca8044

Please sign in to comment.