���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /home/real/node-v13.0.1/test/parallel/ |
'use strict'; require('../common'); const ArrayStream = require('../common/arraystream'); const assert = require('assert'); const repl = require('repl'); let count = 0; function run({ command, expected }) { let accum = ''; const output = new ArrayStream(); output.write = (data) => accum += data.replace('\r', ''); const r = repl.start({ prompt: '', input: new ArrayStream(), output, terminal: false, useColors: false }); r.write(`${command}\n`); if (typeof expected === 'string') { assert.strictEqual(accum, expected); } else { assert(expected.test(accum), accum); } // Verify that the repl is still working as expected. accum = ''; r.write('1 + 1\n'); assert.strictEqual(accum, '2\n'); r.close(); count++; } const tests = [ { command: 'x', expected: 'Thrown:\n' + 'ReferenceError: x is not defined\n' }, { command: 'process.on("uncaughtException", () => console.log("Foobar"));\n', expected: /^Thrown:\nTypeError \[ERR_INVALID_REPL_INPUT]: Listeners for `/ }, { command: 'x;\n', expected: 'Thrown:\n' + 'ReferenceError: x is not defined\n' }, { command: 'process.on("uncaughtException", () => console.log("Foobar"));' + 'console.log("Baz");\n', expected: /^Thrown:\nTypeError \[ERR_INVALID_REPL_INPUT]: Listeners for `/ }, { command: 'console.log("Baz");' + 'process.on("uncaughtException", () => console.log("Foobar"));\n', expected: /^Baz\nThrown:\nTypeError \[ERR_INVALID_REPL_INPUT]:.*uncaughtException/ } ]; process.on('exit', () => { // To actually verify that the test passed we have to make sure no // `uncaughtException` listeners exist anymore. process.removeAllListeners('uncaughtException'); assert.strictEqual(count, tests.length); }); tests.forEach(run);