Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add known issue test for #7788 #7793

Merged
merged 1 commit into from
Jul 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

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: 2 additions & 0 deletions test/fixtures/is-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'use strict';
module.exports.isObject = (obj) => obj.constructor === Object;
32 changes: 32 additions & 0 deletions test/known_issues/test-repl-require-context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';
// Refs: https://github.com/nodejs/node/issues/7788
const common = require('../common');
const assert = require('assert');
const path = require('path');
const repl = require('repl');
const stream = require('stream');
const inputStream = new stream.PassThrough();
const outputStream = new stream.PassThrough();
const fixture = path.join(common.fixturesDir, 'is-object.js');
const r = repl.start({
input: inputStream,
output: outputStream,
useGlobal: false
});

let output = '';
outputStream.setEncoding('utf8');
outputStream.on('data', (data) => output += data);

r.on('exit', common.mustCall(() => {
const results = output.split('\n').map((line) => {
return line.replace(/\w*>\w*/, '').trim();
});

assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']);
}));

inputStream.write('const isObject = (obj) => obj.constructor === Object;\n');
inputStream.write('isObject({});\n');
inputStream.write(`require('${fixture}').isObject({});\n`);
r.close();