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

Use assert.strictEqual() instead of assert.equal() #813

Merged
merged 1 commit into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions node-tests/acceptance/exam-iterate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ describe('Acceptance | Exam Iterate Command', function () {
splitErrorRE.test(error.stderr),
'expected stderr to contain the appropriate error message'
);
assert.equal(error.exitCode, 1);
assert.equal(error.failed, true);
assert.equal(error.killed, false);
assert.strictEqual(error.exitCode, 1);
assert.strictEqual(error.failed, true);
assert.strictEqual(error.killed, false);
});
});

Expand Down Expand Up @@ -168,8 +168,8 @@ describe('Acceptance | Exam Iterate Command', function () {
return execa('ember', ['exam:iterate', '1']).then(
assertExpectRejection,
(error) => {
assert.equal(error.exitCode, 1);
assert.equal(error.killed, false);
assert.strictEqual(error.exitCode, 1);
assert.strictEqual(error.killed, false);
}
);
});
Expand Down
26 changes: 13 additions & 13 deletions node-tests/acceptance/exam-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Acceptance | Exam Command', function () {

function assertAllPartitions(output) {
assertOutput(output, 'Exam Partition', [1, 2, 3]);
assert.equal(
assert.strictEqual(
getNumberOfTests(output),
getTotalNumberOfTests(output),
'ran all of the tests in the suite'
Expand All @@ -85,7 +85,7 @@ describe('Acceptance | Exam Command', function () {
!stdout.includes('Exam Partition'),
'does not add any sort of partition info'
);
assert.equal(
assert.strictEqual(
getNumberOfTests(stdout),
getTotalNumberOfTests(stdout),
'ran all of the tests in the suite'
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('Acceptance | Exam Command', function () {
!stdout.includes('Exam Partition'),
'does not add any sort of partition info'
);
assert.equal(
assert.strictEqual(
getNumberOfTests(stdout),
getTotalNumberOfTests(stdout),
'ran all of the tests in the suite'
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('Acceptance | Exam Command', function () {
stdout.includes('Randomizing tests with seed: 1337'),
'logged the seed value'
);
assert.equal(
assert.strictEqual(
getNumberOfTests(stdout),
getTotalNumberOfTests(stdout),
'ran all of the tests in the suite'
Expand All @@ -306,7 +306,7 @@ describe('Acceptance | Exam Command', function () {

const testExecutionFile = fs.readJsonSync(testExecutionPath);

assert.equal(
assert.strictEqual(
testExecutionFile.failedBrowsers.length,
numberOfFailedBrowsers,
'failed browsers array is correctly recorded'
Expand Down Expand Up @@ -361,7 +361,7 @@ describe('Acceptance | Exam Command', function () {

assertTestExecutionFailedBrowsers(output, 0);
assertOutput(output, 'Browser Id', [1]);
assert.equal(
assert.strictEqual(
getNumberOfTests(output),
getTotalNumberOfTests(output),
'ran all of the tests in the suite'
Expand Down Expand Up @@ -397,7 +397,7 @@ describe('Acceptance | Exam Command', function () {

assertTestExecutionFailedBrowsers(output, 0);
assertOutput(output, 'Browser Id', [1, 2, 3]);
assert.equal(
assert.strictEqual(
getNumberOfTests(output),
getTotalNumberOfTests(output),
'ran all of the tests in the suite'
Expand Down Expand Up @@ -546,14 +546,14 @@ describe('Acceptance | Exam Command', function () {
'acceptance-dist',
]).then((child) => {
const output = child.stdout;
assert.equal(
assert.strictEqual(
output.match(/test-execution-([0-9]*).json/g),
null,
'no test execution json should be written'
);

assertOutput(output, 'Browser Id', [1]);
assert.equal(
assert.strictEqual(
getNumberOfTests(output),
27,
'ran all of the tests for browser one'
Expand All @@ -574,14 +574,14 @@ describe('Acceptance | Exam Command', function () {
'acceptance-dist',
]).then((child) => {
const output = child.stdout;
assert.equal(
assert.strictEqual(
output.match(/test-execution-([0-9]*).json/g),
null,
'no test execution json should be written'
);

assertOutput(output, 'Browser Id', [1, 2]);
assert.equal(
assert.strictEqual(
getNumberOfTests(output),
getTotalNumberOfTests(output),
'ran all of the tests in the suite'
Expand All @@ -604,14 +604,14 @@ describe('Acceptance | Exam Command', function () {
'acceptance-dist',
]).then((child) => {
const output = child.stdout;
assert.equal(
assert.strictEqual(
output.match(/test-execution-([0-9]*).json/g),
null,
'no test execution json should be written'
);

assertOutput(output, 'Browser Id', ['2']);
assert.equal(
assert.strictEqual(
getNumberOfTests(output),
40,
'ran all of the tests for browser two'
Expand Down
28 changes: 14 additions & 14 deletions node-tests/unit/commands/exam-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,32 @@ describe('ExamCommand', function () {

it('should defer to super with normal build task', function () {
return command.run({}).then(function () {
assert.equal(called.testRun, true);
assert.equal(called.buildRun, true);
assert.strictEqual(called.testRun, true);
assert.strictEqual(called.buildRun, true);
});
});

it('should set `modulePath` in the query option', function () {
return command.run({ modulePath: 'foo' }).then(function () {
assert.equal(called.testRunOptions.query, 'modulePath=foo');
assert.strictEqual(called.testRunOptions.query, 'modulePath=foo');
});
});

it('should set `partition` in the query option with one partition', function () {
return command.run({ split: 2, partition: [2] }).then(function () {
assert.equal(called.testRunOptions.query, 'split=2&partition=2');
assert.strictEqual(called.testRunOptions.query, 'split=2&partition=2');
});
});

it('should set `load-balance` in the query option', function () {
return command.run({ loadBalance: true, parallel: 1 }).then(function () {
assert.equal(called.testRunOptions.query, 'loadBalance');
assert.strictEqual(called.testRunOptions.query, 'loadBalance');
});
});

it('should set `partition` in the query option with multiple partitions', function () {
return command.run({ split: 2, partition: [1, 2] }).then(function () {
assert.equal(
assert.strictEqual(
called.testRunOptions.query,
'split=2&partition=1&partition=2'
);
Expand All @@ -94,7 +94,7 @@ describe('ExamCommand', function () {
return command
.run({ split: 2, partition: [2], query: 'someQuery=derp&hidepassed' })
.then(function () {
assert.equal(
assert.strictEqual(
called.testRunOptions.query,
'someQuery=derp&hidepassed&split=2&partition=2'
);
Expand All @@ -105,27 +105,27 @@ describe('ExamCommand', function () {
return command
.run({ split: 2, partition: [1, 2], parallel: 1 })
.then(function () {
assert.equal(called.testRunOptions.query, 'split=2');
assert.strictEqual(called.testRunOptions.query, 'split=2');
});
});

it('should not append `partition` to the query option when not parallelizing without partitions', function () {
return command.run({ split: 2 }).then(function () {
assert.equal(called.testRunOptions.query, 'split=2');
assert.strictEqual(called.testRunOptions.query, 'split=2');
});
});

it('should set `seed=1337` in the query option', function () {
return command.run({ random: '1337' }).then(function () {
assert.equal(called.testRunOptions.query, 'seed=1337');
assert.strictEqual(called.testRunOptions.query, 'seed=1337');
});
});

it('should append `seed=1337` to the query option', function () {
return command
.run({ random: '1337', query: 'someQuery=derp&hidepassed' })
.then(function () {
assert.equal(
assert.strictEqual(
called.testRunOptions.query,
'someQuery=derp&hidepassed&seed=1337'
);
Expand All @@ -135,14 +135,14 @@ describe('ExamCommand', function () {
it('should set `seed=random_seed` in the query option', function () {
const randomStub = sinon.stub(Math, 'random').returns(' random_seed');
return command.run({ random: '' }).then(function () {
assert.equal(called.testRunOptions.query, 'seed=random_seed');
assert.strictEqual(called.testRunOptions.query, 'seed=random_seed');
randomStub.restore();
});
});

it('should set split env var', function () {
return command.run({ split: 5 }).then(function () {
assert.equal(process.env.EMBER_EXAM_SPLIT_COUNT, '5');
assert.strictEqual(process.env.EMBER_EXAM_SPLIT_COUNT, '5');
});
});
});
Expand All @@ -151,7 +151,7 @@ describe('ExamCommand', function () {
let command;

function assertFramework(command, name) {
assert.equal(command._getTestFramework(), name);
assert.strictEqual(command._getTestFramework(), name);
}

beforeEach(function () {
Expand Down
32 changes: 16 additions & 16 deletions node-tests/unit/utils/execution-state-manager-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('ExecutionStateManager', function () {
it('returns the next module from the shared moduleQueue and state is preserved', function () {
this.stateManager.setTestModuleQueue(this.moduleQueue);

assert.equal(
assert.strictEqual(
this.stateManager.getNextModuleTestModuleQueue(),
'foo',
'correctly returns the next module'
Expand All @@ -44,7 +44,7 @@ describe('ExecutionStateManager', function () {
});

it('get next module returns null if shared moduleQueue is not set', function () {
assert.equal(
assert.strictEqual(
this.stateManager.getNextModuleTestModuleQueue(),
null,
'returns null when moduleQueue has not been set'
Expand All @@ -69,7 +69,7 @@ describe('ExecutionStateManager', function () {
it('returns the next module from the browser specific moduleQueue and state is preserved', function () {
this.stateManager.setReplayExecutionModuleQueue(this.moduleQueue, 1);

assert.equal(
assert.strictEqual(
this.stateManager.getNextModuleReplayExecutionModuleQueue(1),
'foo',
'correctly returns the next module'
Expand All @@ -82,7 +82,7 @@ describe('ExecutionStateManager', function () {
});

it('get next module returns null if browser moduleQueue is not set', function () {
assert.equal(
assert.strictEqual(
this.stateManager.getNextModuleReplayExecutionModuleQueue(1),
null,
'returns null when moduleQueue has not been set'
Expand All @@ -101,7 +101,7 @@ describe('ExecutionStateManager', function () {

describe('moduleRunDetails', function () {
it('returns a map size of 0', function () {
assert.equal(this.stateManager.getModuleMetadata().size, 0);
assert.strictEqual(this.stateManager.getModuleMetadata().size, 0);
});

it('adds a single testDone module metadata to moduleMetadata.', function () {
Expand All @@ -122,11 +122,11 @@ describe('ExecutionStateManager', function () {
.getModuleMetadata()
.get(testModuleName);

assert.equal(fooModuleMetadata.passed, 1);
assert.equal(fooModuleMetadata.failed, 0);
assert.equal(fooModuleMetadata.skipped, 0);
assert.equal(fooModuleMetadata.duration, 1);
assert.equal(fooModuleMetadata.failedTests.length, 0);
assert.strictEqual(fooModuleMetadata.passed, 1);
assert.strictEqual(fooModuleMetadata.failed, 0);
assert.strictEqual(fooModuleMetadata.skipped, 0);
assert.strictEqual(fooModuleMetadata.duration, 1);
assert.strictEqual(fooModuleMetadata.failedTests.length, 0);
});

it('adds two test metadata and returns cumulative module data', function () {
Expand Down Expand Up @@ -158,12 +158,12 @@ describe('ExecutionStateManager', function () {
.getModuleMetadata()
.get(fooTestModule);

assert.equal(fooModuleMetadata.total, 2);
assert.equal(fooModuleMetadata.passed, 1);
assert.equal(fooModuleMetadata.failed, 1);
assert.equal(fooModuleMetadata.skipped, 0);
assert.equal(fooModuleMetadata.duration, 2.8);
assert.equal(fooModuleMetadata.failedTests.length, 1);
assert.strictEqual(fooModuleMetadata.total, 2);
assert.strictEqual(fooModuleMetadata.passed, 1);
assert.strictEqual(fooModuleMetadata.failed, 1);
assert.strictEqual(fooModuleMetadata.skipped, 0);
assert.strictEqual(fooModuleMetadata.duration, 2.8);
assert.strictEqual(fooModuleMetadata.failedTests.length, 1);
});
});
});
2 changes: 1 addition & 1 deletion node-tests/unit/utils/test-page-helper-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('TestPageHelper', function () {
test_page: 'loadBalance&browser=1',
},
};
assert.equal(getBrowserId(launcher), 1);
assert.strictEqual(getBrowserId(launcher), 1);
});

it('should throw an error if the launcher does not have test page set', function () {
Expand Down
4 changes: 2 additions & 2 deletions node-tests/unit/utils/testem-events-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe('TestemEvents', function () {
'0000'
);

assert.equal(
assert.strictEqual(
this.testemEvents.stateManager.getCompletedBrowser(),
1,
'completedBrowsers was incremented'
Expand Down Expand Up @@ -424,7 +424,7 @@ describe('TestemEvents', function () {
'0000'
);

assert.equal(
assert.strictEqual(
this.testemEvents.stateManager.getCompletedBrowser(),
1,
'completedBrowsers was incremented'
Expand Down
6 changes: 3 additions & 3 deletions node-tests/unit/utils/tests-options-validator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('TestOptionsValidator', function () {
options.framework,
emberCliVer
);
assert.equal(validateCommand(validator, cmd), value);
assert.strictEqual(validateCommand(validator, cmd), value);
}

function shouldWarn(cmd, options, value, emberCliVer = '3.7.0') {
Expand All @@ -66,8 +66,8 @@ describe('TestOptionsValidator', function () {
emberCliVer
);
assert.notEqual(validateCommand(validator, cmd), undefined);
assert.equal(warnCalled, 1);
assert.equal(warnMessage, value);
assert.strictEqual(warnCalled, 1);
assert.strictEqual(warnMessage, value);

console.warn = originalWarn;
/* eslint-enable no-console */
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/qunit/filter-test-modules-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) {
setupTest(hooks);

test('should return an input string without file extension when the input contains file extension', function (assert) {
assert.equal(
assert.strictEqual(
convertFilePathToModulePath('/tests/integration/foo.js'),
'/tests/integration/foo'
);
});

test(`should return an input string without file extension when the input doesn't contain file extension`, function (assert) {
assert.equal(
assert.strictEqual(
convertFilePathToModulePath('/tests/integration/foo'),
'/tests/integration/foo'
);
});

test('should return an input string after `tests` when the input is a full test file path', function (assert) {
assert.equal(
assert.strictEqual(
convertFilePathToModulePath('dummy/tests/integration/foo.js'),
'/tests/integration/foo'
);
Expand Down