mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
PR-URL: https://github.com/nodejs/node/pull/59964 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
19 lines
567 B
JavaScript
19 lines
567 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { startNewREPLServer } = require('../common/repl');
|
|
|
|
// Pasting big input should not cause the process to have a huge CPU usage.
|
|
|
|
const cpuUsage = process.cpuUsage();
|
|
|
|
const { replServer } = startNewREPLServer({}, { disableDomainErrorAssert: true });
|
|
replServer.input.emit('data', 'a'.repeat(2e4) + '\n');
|
|
replServer.input.emit('data', '.exit\n');
|
|
|
|
replServer.once('exit', common.mustCall(() => {
|
|
const diff = process.cpuUsage(cpuUsage);
|
|
assert.ok(diff.user < 1e6);
|
|
}));
|