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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const constants = process.binding('constants').os;
const { deprecate } = require('internal/util');
const isWindows = process.platform === 'win32';

const { ERR_SYSTEM_ERROR } = require('internal/errors');
const { codes: { ERR_SYSTEM_ERROR } } = require('internal/errors');

const {
getCPUs,
Expand Down
15 changes: 15 additions & 0 deletions test/parallel/test-os-checked-function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';
// Monkey patch the os binding before requiring any other modules, including
// common, which requires the os module.
process.binding('os').getHomeDirectory = function(ctx) {
ctx.syscall = 'foo';
ctx.code = 'bar';
ctx.message = 'baz';
};

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

common.expectsError(os.homedir, {
message: /^A system error occurred: foo returned bar \(baz\)$/
});