MCPcopy Index your code
hub / github.com/nodejs/node / run

Function run

test/parallel/test-repl-envvars.js:56–83  ·  view source on GitHub ↗
(test)

Source from the content-addressed store, hash-verified

54];
55
56function run(test) {
57 const env = test.env;
58 const expected = test.expected;
59
60 const opts = {
61 terminal: true,
62 input: new stream.Readable({ read() {} }),
63 output: new stream.Writable({ write() {} })
64 };
65
66 Object.assign(process.env, env);
67
68 return new Promise((resolve) => {
69 REPL.createInternalRepl(process.env, opts, common.mustSucceed((repl) => {
70 assert.strictEqual(repl.terminal, expected.terminal,
71 `Expected ${inspect(expected)} with ${inspect(env)}`);
72 assert.strictEqual(repl.useColors, expected.useColors,
73 `Expected ${inspect(expected)} with ${inspect(env)}`);
74 assert.strictEqual(repl.replMode, expected.replMode || REPL_MODE_SLOPPY,
75 `Expected ${inspect(expected)} with ${inspect(env)}`);
76 for (const key of Object.keys(env)) {
77 delete process.env[key];
78 }
79 repl.close();
80 resolve();
81 }));
82 });
83}
84
85describe('REPL environment variables', { concurrency: 1 }, () => {
86 tests.forEach((testCase) => test(inspect(testCase.env), () => run(testCase)));

Callers 1

Calls 5

assignMethod · 0.80
inspectFunction · 0.70
keysMethod · 0.65
closeMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected