Skip to content

Commit 16b2fb4

Browse files
Lxxyxtargos
authored andcommitted
test: increase coverage for repl
Refs: https://coverage.nodejs.org/coverage-7abc7e45b2e17730/lib/internal/repl.js.html#L33 PR-URL: #38559 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent dcae032 commit 16b2fb4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/parallel/test-repl-envvars.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const stream = require('stream');
77
const REPL = require('internal/repl');
88
const assert = require('assert');
99
const inspect = require('util').inspect;
10+
const { REPL_MODE_SLOPPY, REPL_MODE_STRICT } = require('repl');
1011

1112
const tests = [
1213
{
@@ -33,6 +34,14 @@ const tests = [
3334
env: { NODE_NO_READLINE: '0' },
3435
expected: { terminal: true, useColors: true }
3536
},
37+
{
38+
env: { NODE_REPL_MODE: 'sloppy' },
39+
expected: { terminal: true, useColors: true, replMode: REPL_MODE_SLOPPY }
40+
},
41+
{
42+
env: { NODE_REPL_MODE: 'strict' },
43+
expected: { terminal: true, useColors: true, replMode: REPL_MODE_STRICT }
44+
},
3645
];
3746

3847
function run(test) {
@@ -54,6 +63,8 @@ function run(test) {
5463
`Expected ${inspect(expected)} with ${inspect(env)}`);
5564
assert.strictEqual(repl.useColors, expected.useColors,
5665
`Expected ${inspect(expected)} with ${inspect(env)}`);
66+
assert.strictEqual(repl.replMode, expected.replMode || REPL_MODE_SLOPPY,
67+
`Expected ${inspect(expected)} with ${inspect(env)}`);
5768
for (const key of Object.keys(env)) {
5869
delete process.env[key];
5970
}

0 commit comments

Comments
 (0)