0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/sequential/test-inspector-stop-profile-after-done.js
Rich Trott da226eaa86 test: fix assertion argument order
Fix the assertion argument order so that it will report "actual" and
"expected" correctly when the test fails.

Ref: https://github.com/nodejs/node/issues/19263

PR-URL: https://github.com/nodejs/node/pull/19264
Refs: https://github.com/nodejs/node/issues/19263
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-03-12 08:42:21 -07:00

33 lines
1.2 KiB
JavaScript

// Flags: --expose-internals
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const assert = require('assert');
const { NodeInstance } = require('../common/inspector-helper.js');
async function runTests() {
const child = new NodeInstance(['--inspect-brk=0'],
`let c = 0;
const interval = setInterval(() => {
console.log(new Object());
if (c++ === 10)
clearInterval(interval);
}, ${common.platformTimeout(30)});`);
const session = await child.connectInspectorSession();
session.send([
{ method: 'Profiler.setSamplingInterval',
params: { interval: common.platformTimeout(300) } },
{ method: 'Profiler.enable' },
{ method: 'Runtime.runIfWaitingForDebugger' },
{ method: 'Profiler.start' }]);
while (await child.nextStderrString() !==
'Waiting for the debugger to disconnect...');
await session.send({ method: 'Profiler.stop' });
session.disconnect();
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
}
common.crashOnUnhandledRejection();
runTests();