mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
The inspector tests should not be in the parallel directory as they likely all (or certainly almost all) use static ports, so port collisions will happen. This moves them all to sequential. We can move them back on a case-by-case basis. They were run sequentially when they were in the inspector directory which they were only moved from very recently. PR-URL: https://github.com/nodejs/node/pull/16281 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com>
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const assert = require('assert');
|
|
const { Session } = require('inspector');
|
|
|
|
const session = new Session();
|
|
|
|
common.expectsError(
|
|
() => session.post('Runtime.evaluate', { expression: '2 + 2' }),
|
|
{
|
|
code: 'ERR_INSPECTOR_NOT_CONNECTED',
|
|
type: Error,
|
|
message: 'Session is not connected'
|
|
}
|
|
);
|
|
|
|
assert.doesNotThrow(() => session.connect());
|
|
|
|
assert.doesNotThrow(
|
|
() => session.post('Runtime.evaluate', { expression: '2 + 2' }));
|
|
|
|
[1, {}, [], true, Infinity, undefined].forEach((i) => {
|
|
common.expectsError(
|
|
() => session.post(i),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError,
|
|
message:
|
|
'The "method" argument must be of type string. ' +
|
|
`Received type ${typeof i}`
|
|
}
|
|
);
|
|
});
|
|
|
|
[1, true, Infinity].forEach((i) => {
|
|
common.expectsError(
|
|
() => session.post('test', i),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError,
|
|
message:
|
|
'The "params" argument must be of type object. ' +
|
|
`Received type ${typeof i}`
|
|
}
|
|
);
|
|
});
|
|
|
|
common.expectsError(
|
|
() => session.connect(),
|
|
{
|
|
code: 'ERR_INSPECTOR_ALREADY_CONNECTED',
|
|
type: Error,
|
|
message: 'The inspector is already connected'
|
|
}
|
|
);
|
|
|
|
assert.doesNotThrow(() => session.disconnect());
|
|
assert.doesNotThrow(() => session.disconnect());
|