Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: correct assertion argument order in test/sequential/test-inspector.js #23618

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions test/sequential/test-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ const assert = require('assert');
const { NodeInstance } = require('../common/inspector-helper.js');

function checkListResponse(response) {
assert.strictEqual(1, response.length);
const expectedResponseLength = 1;
assert.strictEqual(
response.length,
expectedResponseLength,
`Expected list response length to be ${expectedResponseLength}.`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this removes important information because we do not know what the actual value actually is.

Copy link
Contributor Author

@JeffMarvin JeffMarvin Oct 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BridgeAR
I see that now. :)
Is it worth pushing a small fix for this? (It's easy enough for me to do, but I'm not sure if that will mess up your review process...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeffMarvin It won't mess up the process, here are instructions on how to update the PR

We'll squash the commits before pushing it to master

);
assert.ok(response[0].devtoolsFrontendUrl);
assert.ok(
/ws:\/\/localhost:\d+\/[0-9A-Fa-f]{8}-/
Expand Down Expand Up @@ -41,7 +46,11 @@ function assertScopeValues({ result }, expected) {
for (const actual of result) {
const value = expected[actual.name];
if (value) {
assert.strictEqual(value, actual.value.value);
assert.strictEqual(
actual.value.value,
value,
`Expected scope values to be ${actual.value.value} instead of ${value}.`
);
unmatched.delete(actual.name);
}
}
Expand Down Expand Up @@ -117,15 +126,24 @@ async function testBreakpoint(session) {
'generatePreview': true
}
});

assert.strictEqual(1002, result.value);
const expectedEvaluation = 1002;
assert.strictEqual(
result.value,
expectedEvaluation,
`Expected evaluation to be ${expectedEvaluation}, got ${result.value}.`
);

result = (await session.send({
'method': 'Runtime.evaluate', 'params': {
'expression': '5 * 5'
}
})).result;
assert.strictEqual(25, result.value);
const expectedResult = 25;
assert.strictEqual(
result.value,
expectedResult,
`Expected Runtime.evaluate to be ${expectedResult}, got ${result.value}.`
);
}

async function testI18NCharacters(session) {
Expand Down Expand Up @@ -288,7 +306,13 @@ async function runTest() {
await testI18NCharacters(session);
await testCommandLineAPI(session);
await session.runToCompletion();
assert.strictEqual(55, (await child.expectShutdown()).exitCode);
const expectedExitCode = 55;
const { exitCode } = await child.expectShutdown();
assert.strictEqual(
exitCode,
expectedExitCode,
`Expected exit code to be ${expectedExitCode} but got ${expectedExitCode}.`
);
}

runTest();