Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2e05e65

Browse filesBrowse files
cjihrigevanlucas
authored andcommitted
test: add known issue test for #7788
15157c3 changed the CLI REPL to default to useGlobal: false by default. This caused the regression seen in #7788. This commit adds a known issue test while a proper resolution is determined. Refs: #5703 Refs: #7788 PR-URL: #7793 Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 7fb4794 commit 2e05e65
Copy full SHA for 2e05e65

File tree

Expand file treeCollapse file tree

2 files changed

+34
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+34
-0
lines changed
Open diff view settings
Collapse file

‎test/fixtures/is-object.js‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
'use strict';
2+
module.exports.isObject = (obj) => obj.constructor === Object;
Collapse file
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
// Refs: https://github.com/nodejs/node/issues/7788
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const path = require('path');
6+
const repl = require('repl');
7+
const stream = require('stream');
8+
const inputStream = new stream.PassThrough();
9+
const outputStream = new stream.PassThrough();
10+
const fixture = path.join(common.fixturesDir, 'is-object.js');
11+
const r = repl.start({
12+
input: inputStream,
13+
output: outputStream,
14+
useGlobal: false
15+
});
16+
17+
let output = '';
18+
outputStream.setEncoding('utf8');
19+
outputStream.on('data', (data) => output += data);
20+
21+
r.on('exit', common.mustCall(() => {
22+
const results = output.split('\n').map((line) => {
23+
return line.replace(/\w*>\w*/, '').trim();
24+
});
25+
26+
assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']);
27+
}));
28+
29+
inputStream.write('const isObject = (obj) => obj.constructor === Object;\n');
30+
inputStream.write('isObject({});\n');
31+
inputStream.write(`require('${fixture}').isObject({});\n`);
32+
r.close();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.