mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
7534477786
PR-URL: https://github.com/nodejs/node/pull/32542 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
21 lines
532 B
JavaScript
21 lines
532 B
JavaScript
'use strict';
|
|
// Flags: --expose-internals
|
|
|
|
require('../common');
|
|
const { internalBinding } = require('internal/test/binding');
|
|
const assert = require('assert');
|
|
|
|
// Monkey patch the os binding before requiring any other modules, including
|
|
// common, which requires the os module.
|
|
internalBinding('os').getHomeDirectory = function(ctx) {
|
|
ctx.syscall = 'foo';
|
|
ctx.code = 'bar';
|
|
ctx.message = 'baz';
|
|
};
|
|
|
|
const os = require('os');
|
|
|
|
assert.throws(os.homedir, {
|
|
message: /^A system error occurred: foo returned bar \(baz\)$/
|
|
});
|