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

Tests: Avoid the 'was called with' assertion #3680

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions test/node-unit/cli/options.spec.js
Expand Up @@ -114,7 +114,7 @@ describe('options', function() {
try {
loadOptions(`--opts ${opts}`);
} catch (ignored) {}
expect(readFileSync, 'was called with', opts, 'utf8');
expect(readFileSync, 'to have a call satisfying', [opts, 'utf8']);
});

it('should throw', function() {
Expand Down Expand Up @@ -151,7 +151,10 @@ describe('options', function() {
});

it('should attempt to load default mocha.opts', function() {
expect(readFileSync, 'was called with', defaults.opts, 'utf8');
expect(readFileSync, 'to have a call satisfying', [
defaults.opts,
'utf8'
]);
});

it('should set opts = false', function() {
Expand Down Expand Up @@ -514,7 +517,7 @@ describe('options', function() {
try {
loadOptions(`--config ${config}`);
} catch (ignored) {}
expect(loadConfig, 'was called with', config);
expect(loadConfig, 'to have a call satisfying', [config]);
});

it('should throw to warn the user', function() {
Expand Down Expand Up @@ -555,7 +558,9 @@ describe('options', function() {
});

it('should attempt to load file at found path', function() {
expect(loadConfig, 'was called with', '/some/.mocharc.json');
expect(loadConfig, 'to have a call satisfying', [
'/some/.mocharc.json'
]);
});

it('should set config = false', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/mocha.spec.js
Expand Up @@ -24,13 +24,13 @@ describe('Mocha', function() {
it('should prefer "color" over "useColors"', function() {
// eslint-disable-next-line no-new
new Mocha({useColors: true, color: false});
expect(Mocha.prototype.useColors, 'was called with', false);
expect(Mocha.prototype.useColors, 'to have a call satisfying', [false]);
});

it('should assign "useColors" to "color"', function() {
// eslint-disable-next-line no-new
new Mocha({useColors: true});
expect(Mocha.prototype.useColors, 'was called with', true);
expect(Mocha.prototype.useColors, 'to have a call satisfying', [true]);
});

it('should call utils.deprecate()', function() {
Expand Down