blob: e0758437fe873fb0041c25442fca9455b9eb03aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
'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\)$/
});
|