Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Avoid the 'was called with' assertion

Andreas Lind27688bca42a1
diff --git a/test/node-unit/cli/options.spec.js b/test/node-unit/cli/options.spec.js
index 0bf6b2fc..eba791dd 100644
--- a/test/node-unit/cli/options.spec.js
+++ b/test/node-unit/cli/options.spec.js
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
diff --git a/test/unit/mocha.spec.js b/test/unit/mocha.spec.js
index 5cb6319d..58053362 100644
--- a/test/unit/mocha.spec.js
+++ b/test/unit/mocha.spec.js
@@ -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() {