From 19c779e7540611457dafb6c1f71daf6caa6f4dcf Mon Sep 17 00:00:00 2001 From: Carl-Erik Kopseng Date: Fri, 20 Oct 2023 15:39:41 +0200 Subject: [PATCH] Apply Prettier 3 defaults of trailing commas --- CHANGES.md | 3 - docs/_howto/typescript-swc.md | 2 +- docs/changelog.md | 3 - docs/index.md | 2 +- .../spies-2-wrap-object-methods.test.js | 4 +- .../release/fake-xhr-and-server.md | 2 +- lib/sinon.js | 2 +- lib/sinon/assert.js | 44 ++-- lib/sinon/behavior.js | 20 +- lib/sinon/create-stub-instance.js | 2 +- lib/sinon/default-behaviors.js | 8 +- lib/sinon/mock-expectation.js | 30 +-- lib/sinon/mock.js | 10 +- lib/sinon/proxy-call-util.js | 4 +- lib/sinon/proxy-call.js | 22 +- lib/sinon/proxy-invoke.js | 2 +- lib/sinon/proxy.js | 18 +- lib/sinon/sandbox.js | 34 +-- lib/sinon/spy-formatters.js | 6 +- lib/sinon/spy.js | 20 +- lib/sinon/stub.js | 12 +- lib/sinon/throw-on-falsy-object.js | 2 +- lib/sinon/util/core/export-async-behaviors.js | 4 +- lib/sinon/util/core/extend.js | 8 +- .../util/core/get-property-descriptor.js | 2 +- .../util/core/is-non-existent-property.js | 2 +- lib/sinon/util/core/walk-object.js | 4 +- lib/sinon/util/core/wrap-method.js | 18 +- lib/sinon/util/fake-timers.js | 2 +- test/assert-test.js | 218 +++++++++--------- test/create-stub-instance-test.js | 4 +- test/fake-test.js | 4 +- test/issues/issues-test.js | 26 +-- test/mock-test.js | 100 ++++---- test/promise-test.js | 8 +- test/proxy-call-test.js | 80 +++---- test/proxy-test.js | 20 +- test/restore-object-test.js | 8 +- test/sandbox-test.js | 116 +++++----- test/shared-spy-stub-everything-tests.js | 12 +- test/sinon-test.js | 10 +- test/spy-test.js | 88 +++---- test/stub-test.js | 90 ++++---- test/util/core/walk-object-test.js | 8 +- test/util/core/walk-test.js | 2 +- test/util/core/wrap-method-test.js | 32 +-- test/util/fake-timers-test.js | 22 +- 47 files changed, 568 insertions(+), 572 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fb8d81756..06e82d476 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -55,7 +55,6 @@ _Released by Morgan Roderick on 2023-09-13._ - [`a79ccaeb`](https://github.com/sinonjs/sinon/commit/a79ccaeb20bbb558902ae77b20bd026719de3004) Support callable instances (#2517) (bojavou) > - Support callable instances - > > - Clean prettier lint > > *** @@ -252,7 +251,6 @@ _Released by [Carl-Erik Kopseng](https://github.com/fatso83) on 2022-04-14._ - [`51c508ab`](https://github.com/sinonjs/sinon/commit/51c508ab77cf0f9fb8c5305ff626f6a2eada178f) Add dry run mode to `npm version` (#2436) (Joel Bradshaw) > - Add DRY_RUN flag to skip publish/push - > > - Allow overriding branch names for testing - [`05341dcf`](https://github.com/sinonjs/sinon/commit/05341dcf92ddca4a1d4c90966b1fcdc7039cff18) Update npm version scripts to manage new releases branch (Joel Bradshaw) @@ -282,7 +280,6 @@ _Released by [Carl-Erik Kopseng](https://github.com/fatso83) on 2022-02-01._ Upgrade packages (#2431) (Carl-Erik Kopseng) > - Update all @sinonjs/ packages > - Upgrade to fake-timers 9 - > > - chore: ensure always using latest LTS release - [`41710467`](https://github.com/sinonjs/sinon/commit/417104670d575e96a1b645ea40ce763afa76fb1b) Adjust deploy scripts to archive old releases in a separate branch, move existing releases out of master (#2426) (Joel Bradshaw) diff --git a/docs/_howto/typescript-swc.md b/docs/_howto/typescript-swc.md index c05ea46ee..32b45c1ad 100644 --- a/docs/_howto/typescript-swc.md +++ b/docs/_howto/typescript-swc.md @@ -96,7 +96,7 @@ Let us sprinkle some debugging statements to figure out what the differences bet console.log("Other", Other); console.log( "Other property descriptors", - Object.getOwnPropertyDescriptors(Other) + Object.getOwnPropertyDescriptors(Other), ); ``` diff --git a/docs/changelog.md b/docs/changelog.md index f9af7b030..4274aa7b2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -61,7 +61,6 @@ _Released by Morgan Roderick on 2023-09-13._ - [`a79ccaeb`](https://github.com/sinonjs/sinon/commit/a79ccaeb20bbb558902ae77b20bd026719de3004) Support callable instances (#2517) (bojavou) > - Support callable instances - > > - Clean prettier lint > > *** @@ -258,7 +257,6 @@ _Released by [Carl-Erik Kopseng](https://github.com/fatso83) on 2022-04-14._ - [`51c508ab`](https://github.com/sinonjs/sinon/commit/51c508ab77cf0f9fb8c5305ff626f6a2eada178f) Add dry run mode to `npm version` (#2436) (Joel Bradshaw) > - Add DRY_RUN flag to skip publish/push - > > - Allow overriding branch names for testing - [`05341dcf`](https://github.com/sinonjs/sinon/commit/05341dcf92ddca4a1d4c90966b1fcdc7039cff18) Update npm version scripts to manage new releases branch (Joel Bradshaw) @@ -288,7 +286,6 @@ _Released by [Carl-Erik Kopseng](https://github.com/fatso83) on 2022-02-01._ Upgrade packages (#2431) (Carl-Erik Kopseng) > - Update all @sinonjs/ packages > - Upgrade to fake-timers 9 - > > - chore: ensure always using latest LTS release - [`41710467`](https://github.com/sinonjs/sinon/commit/417104670d575e96a1b645ea40ce763afa76fb1b) Adjust deploy scripts to archive old releases in a separate branch, move existing releases out of master (#2426) (Joel Bradshaw) diff --git a/docs/index.md b/docs/index.md index 6668d49f1..c61f84738 100644 --- a/docs/index.md +++ b/docs/index.md @@ -208,7 +208,7 @@ it("calls callback with deserialized data", function () { server.requests[0].respond( 200, { "Content-Type": "application/json" }, - JSON.stringify([{ id: 1, text: "Provide examples", done: true }]) + JSON.stringify([{ id: 1, text: "Provide examples", done: true }]), ); assert(callback.calledOnce); diff --git a/docs/release-source/release/examples/spies-2-wrap-object-methods.test.js b/docs/release-source/release/examples/spies-2-wrap-object-methods.test.js index 2456af5bf..2246ad7af 100644 --- a/docs/release-source/release/examples/spies-2-wrap-object-methods.test.js +++ b/docs/release-source/release/examples/spies-2-wrap-object-methods.test.js @@ -34,11 +34,11 @@ describe("Wrap all object methods", function () { assert(myExternalLibrary._doNetworkCall.calledOnce); assert.equals( url, - myExternalLibrary._doNetworkCall.getCall(0).args[0].url + myExternalLibrary._doNetworkCall.getCall(0).args[0].url, ); assert.equals( "json", - myExternalLibrary._doNetworkCall.getCall(0).args[0].dataType + myExternalLibrary._doNetworkCall.getCall(0).args[0].dataType, ); }); }); diff --git a/docs/release-source/release/fake-xhr-and-server.md b/docs/release-source/release/fake-xhr-and-server.md index f096b5595..0c5e2a4c1 100644 --- a/docs/release-source/release/fake-xhr-and-server.md +++ b/docs/release-source/release/fake-xhr-and-server.md @@ -269,7 +269,7 @@ server.respondWith(/\/todo-items\/(\d+)/, function (xhr, id) { xhr.respond( 200, { "Content-Type": "application/json" }, - '[{ "id": ' + id + " }]" + '[{ "id": ' + id + " }]", ); }); ``` diff --git a/lib/sinon.js b/lib/sinon.js index f457d5e3c..27528ed54 100644 --- a/lib/sinon.js +++ b/lib/sinon.js @@ -30,7 +30,7 @@ const apiMethods = { fakeServerWithClock: nise.fakeServerWithClock, createFakeServer: nise.fakeServer.create.bind(nise.fakeServer), createFakeServerWithClock: nise.fakeServerWithClock.create.bind( - nise.fakeServerWithClock + nise.fakeServerWithClock, ), addBehavior: function (name, fn) { diff --git a/lib/sinon/assert.js b/lib/sinon/assert.js index 1ce462aec..fc7dbdbe3 100644 --- a/lib/sinon/assert.js +++ b/lib/sinon/assert.js @@ -52,7 +52,7 @@ function createAssertObject() { failAssertion( this, - `expected ${expected} to be called in order but were called as ${actual}` + `expected ${expected} to be called in order but were called as ${actual}`, ); } else { assert.pass("callOrder"); @@ -151,7 +151,7 @@ function createAssertObject() { assert.fail( `${assertionMethod} takes 1 argument but was called with ${ assertionArgs.length + 1 - } arguments` + } arguments`, ); } break; @@ -196,8 +196,8 @@ function createAssertObject() { this, (fake.printf || fake.proxy.printf).apply( fake, - concat([msg], args) - ) + concat([msg], args), + ), ); } else { assert.pass(name); @@ -215,79 +215,79 @@ function createAssertObject() { mirrorPropAsAssertion( "called", - "expected %n to have been called at least once but was never called" + "expected %n to have been called at least once but was never called", ); mirrorPropAsAssertion( "notCalled", function (spy) { return !spy.called; }, - "expected %n to not have been called but was called %c%C" + "expected %n to not have been called but was called %c%C", ); mirrorPropAsAssertion( "calledOnce", - "expected %n to be called once but was called %c%C" + "expected %n to be called once but was called %c%C", ); mirrorPropAsAssertion( "calledTwice", - "expected %n to be called twice but was called %c%C" + "expected %n to be called twice but was called %c%C", ); mirrorPropAsAssertion( "calledThrice", - "expected %n to be called thrice but was called %c%C" + "expected %n to be called thrice but was called %c%C", ); mirrorPropAsAssertion( "calledOn", - "expected %n to be called with %1 as this but was called with %t" + "expected %n to be called with %1 as this but was called with %t", ); mirrorPropAsAssertion( "alwaysCalledOn", - "expected %n to always be called with %1 as this but was called with %t" + "expected %n to always be called with %1 as this but was called with %t", ); mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new"); mirrorPropAsAssertion( "alwaysCalledWithNew", - "expected %n to always be called with new" + "expected %n to always be called with new", ); mirrorPropAsAssertion( "calledWith", - "expected %n to be called with arguments %D" + "expected %n to be called with arguments %D", ); mirrorPropAsAssertion( "calledWithMatch", - "expected %n to be called with match %D" + "expected %n to be called with match %D", ); mirrorPropAsAssertion( "alwaysCalledWith", - "expected %n to always be called with arguments %D" + "expected %n to always be called with arguments %D", ); mirrorPropAsAssertion( "alwaysCalledWithMatch", - "expected %n to always be called with match %D" + "expected %n to always be called with match %D", ); mirrorPropAsAssertion( "calledWithExactly", - "expected %n to be called with exact arguments %D" + "expected %n to be called with exact arguments %D", ); mirrorPropAsAssertion( "calledOnceWithExactly", - "expected %n to be called once and with exact arguments %D" + "expected %n to be called once and with exact arguments %D", ); mirrorPropAsAssertion( "calledOnceWithMatch", - "expected %n to be called once and with match %D" + "expected %n to be called once and with match %D", ); mirrorPropAsAssertion( "alwaysCalledWithExactly", - "expected %n to always be called with exact arguments %D" + "expected %n to always be called with exact arguments %D", ); mirrorPropAsAssertion( "neverCalledWith", - "expected %n to never be called with arguments %*%C" + "expected %n to never be called with arguments %*%C", ); mirrorPropAsAssertion( "neverCalledWithMatch", - "expected %n to never be called with match %*%C" + "expected %n to never be called with match %*%C", ); mirrorPropAsAssertion("threw", "%n did not throw exception%C"); mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C"); diff --git a/lib/sinon/behavior.js b/lib/sinon/behavior.js index 633263867..a7d2b2796 100644 --- a/lib/sinon/behavior.js +++ b/lib/sinon/behavior.js @@ -57,13 +57,13 @@ function getCallbackError(behavior, func, args) { if (behavior.callArgProp) { msg = `${functionName( - behavior.stub + behavior.stub, )} expected to yield to '${valueToString( - behavior.callArgProp + behavior.callArgProp, )}', but no object with such a property was passed.`; } else { msg = `${functionName( - behavior.stub + behavior.stub, )} expected to yield, but no callback was passed.`; } @@ -87,7 +87,7 @@ function ensureArgs(name, behavior, args) { throw new TypeError( `${name} failed: ${index + 1} arguments required but only ${ args.length - } present` + } present`, ); } } @@ -105,13 +105,13 @@ function callCallback(behavior, args) { nextTick(function () { func.apply( behavior.callbackContext, - behavior.callbackArguments + behavior.callbackArguments, ); }); } else { return func.apply( behavior.callbackContext, - behavior.callbackArguments + behavior.callbackArguments, ); } } @@ -178,7 +178,7 @@ const proto = { } else if (typeof this.resolveArgAt === "number") { ensureArgs("resolvesArg", this, args); return (this.promiseLibrary || Promise).resolve( - args[this.resolveArgAt] + args[this.resolveArgAt], ); } else if (this.resolveThis) { return (this.promiseLibrary || Promise).resolve(context); @@ -198,7 +198,7 @@ const proto = { // Call the constructor const F = WrappedClass.bind.apply( WrappedClass, - concat([null], argsArray) + concat([null], argsArray), ); return new F(); } else if (typeof this.returnValue !== "undefined") { @@ -239,7 +239,7 @@ const proto = { throw new Error( 'Defining a stub by invoking "stub.onCall(...).withArgs(...)" ' + 'is not supported. Use "stub.withArgs(...).onCall(...)" ' + - "to define sequential behavior for calls with certain arguments." + "to define sequential behavior for calls with certain arguments.", ); }, }; @@ -249,7 +249,7 @@ function createBehavior(behaviorMethod) { this.defaultBehavior = this.defaultBehavior || proto.create(this); this.defaultBehavior[behaviorMethod].apply( this.defaultBehavior, - arguments + arguments, ); return this; }; diff --git a/lib/sinon/create-stub-instance.js b/lib/sinon/create-stub-instance.js index dce3126d0..0029ca81f 100644 --- a/lib/sinon/create-stub-instance.js +++ b/lib/sinon/create-stub-instance.js @@ -28,7 +28,7 @@ module.exports = function createStubInstance(constructor, overrides) { } } else { throw new Error( - `Cannot stub ${propertyName}. Property does not exist!` + `Cannot stub ${propertyName}. Property does not exist!`, ); } }); diff --git a/lib/sinon/default-behaviors.js b/lib/sinon/default-behaviors.js index 1be5f9af1..a2731da82 100644 --- a/lib/sinon/default-behaviors.js +++ b/lib/sinon/default-behaviors.js @@ -16,7 +16,7 @@ function throwsException(fake, error, message) { } else if (typeof error === "string") { fake.exceptionCreator = function () { const newException = new Error( - message || `Sinon-provided ${error}` + message || `Sinon-provided ${error}`, ); newException.name = error; return newException; @@ -241,7 +241,7 @@ const defaultBehaviors = { get: getterFunction, configurable: isPropertyConfigurable( rootStub.rootObj, - rootStub.propName + rootStub.propName, ), }); @@ -259,9 +259,9 @@ const defaultBehaviors = { set: setterFunction, configurable: isPropertyConfigurable( rootStub.rootObj, - rootStub.propName + rootStub.propName, ), - } + }, ); return fake; diff --git a/lib/sinon/mock-expectation.js b/lib/sinon/mock-expectation.js index 6b48aa219..e248f6380 100644 --- a/lib/sinon/mock-expectation.js +++ b/lib/sinon/mock-expectation.js @@ -148,15 +148,15 @@ const mockExpectation = { if (receivedMaxCalls(this)) { this.failed = true; mockExpectation.fail( - `${this.method} already called ${timesInWords(this.maxCalls)}` + `${this.method} already called ${timesInWords(this.maxCalls)}`, ); } if ("expectedThis" in this && this.expectedThis !== thisValue) { mockExpectation.fail( `${this.method} called with ${valueToString( - thisValue - )} as thisValue, expected ${valueToString(this.expectedThis)}` + thisValue, + )} as thisValue, expected ${valueToString(this.expectedThis)}`, ); } @@ -167,16 +167,16 @@ const mockExpectation = { if (!args) { mockExpectation.fail( `${this.method} received no arguments, expected ${inspect( - expectedArguments - )}` + expectedArguments, + )}`, ); } if (args.length < expectedArguments.length) { mockExpectation.fail( `${this.method} received too few arguments (${inspect( - args - )}), expected ${inspect(expectedArguments)}` + args, + )}), expected ${inspect(expectedArguments)}`, ); } @@ -186,8 +186,8 @@ const mockExpectation = { ) { mockExpectation.fail( `${this.method} received too many arguments (${inspect( - args - )}), expected ${inspect(expectedArguments)}` + args, + )}), expected ${inspect(expectedArguments)}`, ); } @@ -197,20 +197,20 @@ const mockExpectation = { if (!verifyMatcher(expectedArgument, args[i])) { mockExpectation.fail( `${this.method} received wrong arguments ${inspect( - args - )}, didn't match ${String(expectedArguments)}` + args, + )}, didn't match ${String(expectedArguments)}`, ); } if (!deepEqual(args[i], expectedArgument)) { mockExpectation.fail( `${this.method} received wrong arguments ${inspect( - args - )}, expected ${inspect(expectedArguments)}` + args, + )}, expected ${inspect(expectedArguments)}`, ); } }, - this + this, ); }, @@ -286,7 +286,7 @@ const mockExpectation = { const message = `${callStr.replace( ", [...", - "[, ..." + "[, ...", )} ${expectedCallCountInWords(this)}`; if (this.met()) { diff --git a/lib/sinon/mock.js b/lib/sinon/mock.js index fbc81824d..adb137c37 100644 --- a/lib/sinon/mock.js +++ b/lib/sinon/mock.js @@ -143,9 +143,9 @@ extend(mock, { return arrayEquals( expectedArgs, currentArgs, - expectation.expectsExactArgCount + expectation.expectsExactArgCount, ); - } + }, ); const expectationsToApply = filter( @@ -155,7 +155,7 @@ extend(mock, { !expectation.met() && expectation.allowsCall(thisValue, args) ); - } + }, ); if (expectationsToApply.length > 0) { @@ -186,7 +186,7 @@ extend(mock, { `Unexpected call: ${proxyCallToString.call({ proxy: method, args: args, - })}` + })}`, ); const err = new Error(); @@ -204,7 +204,7 @@ extend(mock, { proxy: method, args: args, stack: err.stack, - })}` + })}`, ); mockExpectation.fail(join(messages, "\n")); diff --git a/lib/sinon/proxy-call-util.js b/lib/sinon/proxy-call-util.js index e9c063389..036e6e2af 100644 --- a/lib/sinon/proxy-call-util.js +++ b/lib/sinon/proxy-call-util.js @@ -25,7 +25,7 @@ exports.delegateToCalls = function delegateToCalls( actual, returnsValues, notCalled, - totalCallCount + totalCallCount, ) { proxy[method] = function () { if (!this.called) { @@ -47,7 +47,7 @@ exports.delegateToCalls = function delegateToCalls( currentCall = this.getCall(i); const returnValue = currentCall[actual || method].apply( currentCall, - arguments + arguments, ); push(returnValues, returnValue); if (returnValue) { diff --git a/lib/sinon/proxy-call.js b/lib/sinon/proxy-call.js index d4f51106b..84b5af942 100644 --- a/lib/sinon/proxy-call.js +++ b/lib/sinon/proxy-call.js @@ -48,7 +48,7 @@ const callProto = { function (prev, arg, i) { return prev && deepEqual(self.args[i], arg); }, - true + true, ); }, @@ -67,7 +67,7 @@ const callProto = { return prev && match(expectation).test(actual); }, - true + true, ); }, @@ -131,7 +131,7 @@ const callProto = { callArgWith: function (pos) { return this.callArgOnWith.apply( this, - concat([pos, null], slice(arguments, 1)) + concat([pos, null], slice(arguments, 1)), ); }, @@ -144,7 +144,7 @@ const callProto = { throwArg: function (pos) { if (pos > this.args.length) { throw new TypeError( - `Not enough arguments: ${pos} required but only ${this.args.length} present` + `Not enough arguments: ${pos} required but only ${this.args.length} present`, ); } @@ -165,7 +165,7 @@ const callProto = { throwYieldError( this.proxy, " cannot yield since no callback was passed.", - args + args, ); } @@ -175,7 +175,7 @@ const callProto = { yieldTo: function (prop) { return this.yieldToOn.apply( this, - concat([prop, null], slice(arguments, 1)) + concat([prop, null], slice(arguments, 1)), ); }, @@ -190,9 +190,9 @@ const callProto = { throwYieldError( this.proxy, ` cannot yield to '${valueToString( - prop + prop, )}' since no callback was passed.`, - args + args, ); } @@ -227,7 +227,7 @@ const callProto = { // Skip the first two frames because they will refer to Sinon code callStr += (this.stack.split("\n")[3] || "unknown").replace( /^\s*(?:at\s+|@)?/, - " at " + " at ", ); } @@ -238,7 +238,7 @@ const callProto = { if (typeof this.args[pos] !== "function") { throw new TypeError( `Expected argument at position ${pos} to be a Function, but was ${typeof this - .args[pos]}` + .args[pos]}`, ); } }, @@ -269,7 +269,7 @@ function createProxyCall( returnValue, exception, id, - errorWithCallStack + errorWithCallStack, ) { if (typeof id !== "number") { throw new TypeError("Call id is not a number"); diff --git a/lib/sinon/proxy-invoke.js b/lib/sinon/proxy-invoke.js index 4c9c29f0a..1b120ece5 100644 --- a/lib/sinon/proxy-invoke.js +++ b/lib/sinon/proxy-invoke.js @@ -40,7 +40,7 @@ module.exports = function invoke(func, thisValue, args) { // Call through with `new` returnValue = new (bind.apply( this.func || func, - concat([thisValue], args) + concat([thisValue], args), ))(); if ( diff --git a/lib/sinon/proxy.js b/lib/sinon/proxy.js index 70a84fd2e..47a137089 100644 --- a/lib/sinon/proxy.js +++ b/lib/sinon/proxy.js @@ -57,7 +57,7 @@ const proxyApi = { this.returnValues[i], this.exceptions[i], this.callIds[i], - this.errorsWithCallStack[i] + this.errorsWithCallStack[i], ); }, @@ -137,7 +137,7 @@ const proxyApi = { if (this.invoking) { const err = new Error( "Cannot reset Sinon function while invoking it. " + - "Move the call to .resetHistory outside of the callback." + "Move the call to .resetHistory outside of the callback.", ); err.name = "InvalidResetException"; throw err; @@ -183,7 +183,7 @@ delegateToCalls( "calledWith", false, undefined, - 1 + 1, ); delegateToCalls(proxyApi, "calledWithMatch", true); delegateToCalls(proxyApi, "alwaysCalledWith", false, "calledWith"); @@ -196,7 +196,7 @@ delegateToCalls( "calledWithExactly", false, undefined, - 1 + 1, ); delegateToCalls( proxyApi, @@ -205,13 +205,13 @@ delegateToCalls( "calledWithMatch", false, undefined, - 1 + 1, ); delegateToCalls( proxyApi, "alwaysCalledWithExactly", false, - "calledWithExactly" + "calledWithExactly", ); delegateToCalls( proxyApi, @@ -221,7 +221,7 @@ delegateToCalls( false, function () { return true; - } + }, ); delegateToCalls( proxyApi, @@ -231,7 +231,7 @@ delegateToCalls( false, function () { return true; - } + }, ); delegateToCalls(proxyApi, "threw", true); delegateToCalls(proxyApi, "alwaysThrew", false, "threw"); @@ -334,7 +334,7 @@ function wrapFunction(func, originalFunc) { } const nameDescriptor = Object.getOwnPropertyDescriptor( originalFunc, - "name" + "name", ); if (nameDescriptor && nameDescriptor.configurable) { // IE 11 functions don't have a name. diff --git a/lib/sinon/sandbox.js b/lib/sinon/sandbox.js index 9f62e97f8..ce25a2240 100644 --- a/lib/sinon/sandbox.js +++ b/lib/sinon/sandbox.js @@ -50,7 +50,7 @@ function verifySameType(object, property, replacement) { throw new TypeError( `Cannot replace ${typeof object[ property - ]} with ${typeof replacement}` + ]} with ${typeof replacement}`, ); } } @@ -59,8 +59,8 @@ function checkForValidArguments(descriptor, property, replacement) { if (typeof descriptor === "undefined") { throw new TypeError( `Cannot replace non-existent property ${valueToString( - property - )}. Perhaps you meant sandbox.define()?` + property, + )}. Perhaps you meant sandbox.define()?`, ); } @@ -85,7 +85,7 @@ function Sandbox() { ) { // eslint-disable-next-line no-console logger.printWarning( - "Potential memory leak detected; be sure to call restore() to clean up your sandbox. To suppress this warning, modify the leakThreshold property of your sandbox." + "Potential memory leak detected; be sure to call restore() to clean up your sandbox. To suppress this warning, modify the leakThreshold property of your sandbox.", ); loggedLeakWarning = true; } @@ -197,7 +197,7 @@ function Sandbox() { sandbox.restore = function restore() { if (arguments.length) { throw new Error( - "sandbox.restore() does not take any parameters. Perhaps you meant stub.restore()" + "sandbox.restore() does not take any parameters. Perhaps you meant stub.restore()", ); } @@ -259,7 +259,7 @@ function Sandbox() { fakeRestorer.property === property ) { throw new TypeError( - `Attempted to replace ${property} which is already replaced` + `Attempted to replace ${property} which is already replaced`, ); } }); @@ -292,7 +292,7 @@ function Sandbox() { sandbox.replace.usingAccessor = function replaceUsingAccessor( object, property, - replacement + replacement, ) { const descriptor = getPropertyDescriptor(object, property); checkForValidArguments(descriptor, property, replacement); @@ -314,8 +314,8 @@ function Sandbox() { if (descriptor) { throw new TypeError( `Cannot define the already existing property ${valueToString( - property - )}. Perhaps you meant sandbox.replace()?` + property, + )}. Perhaps you meant sandbox.replace()?`, ); } @@ -336,21 +336,21 @@ function Sandbox() { sandbox.replaceGetter = function replaceGetter( object, property, - replacement + replacement, ) { const descriptor = getPropertyDescriptor(object, property); if (typeof descriptor === "undefined") { throw new TypeError( `Cannot replace non-existent property ${valueToString( - property - )}` + property, + )}`, ); } if (typeof replacement !== "function") { throw new TypeError( - "Expected replacement argument to be a function" + "Expected replacement argument to be a function", ); } @@ -374,21 +374,21 @@ function Sandbox() { sandbox.replaceSetter = function replaceSetter( object, property, - replacement + replacement, ) { const descriptor = getPropertyDescriptor(object, property); if (typeof descriptor === "undefined") { throw new TypeError( `Cannot replace non-existent property ${valueToString( - property - )}` + property, + )}`, ); } if (typeof replacement !== "function") { throw new TypeError( - "Expected replacement argument to be a function" + "Expected replacement argument to be a function", ); } diff --git a/lib/sinon/spy-formatters.js b/lib/sinon/spy-formatters.js index 953b394b7..f867e0ca2 100644 --- a/lib/sinon/spy-formatters.js +++ b/lib/sinon/spy-formatters.js @@ -91,14 +91,14 @@ module.exports = { message += colorSinonMatchText( expectedArg, calledArg, - calledArgMessage + calledArgMessage, ); } else { const expectedArgMessage = j < expectedArgs.length ? inspect(expectedArg) : ""; const diff = jsDiff.diffJson( calledArgMessage, - expectedArgMessage + expectedArgMessage, ); message += colorDiffText(diff); } @@ -138,7 +138,7 @@ module.exports = { map(args, function (arg) { return inspect(arg); }), - ", " + ", ", ); }, }; diff --git a/lib/sinon/spy.js b/lib/sinon/spy.js index 761a557d5..a10e26bf6 100644 --- a/lib/sinon/spy.js +++ b/lib/sinon/spy.js @@ -81,38 +81,38 @@ const spyApi = { const delegateToCalls = proxyCallUtil.delegateToCalls; delegateToCalls(spyApi, "callArg", false, "callArgWith", true, function () { throw new Error( - `${this.toString()} cannot call arg since it was not yet invoked.` + `${this.toString()} cannot call arg since it was not yet invoked.`, ); }); spyApi.callArgWith = spyApi.callArg; delegateToCalls(spyApi, "callArgOn", false, "callArgOnWith", true, function () { throw new Error( - `${this.toString()} cannot call arg since it was not yet invoked.` + `${this.toString()} cannot call arg since it was not yet invoked.`, ); }); spyApi.callArgOnWith = spyApi.callArgOn; delegateToCalls(spyApi, "throwArg", false, "throwArg", false, function () { throw new Error( - `${this.toString()} cannot throw arg since it was not yet invoked.` + `${this.toString()} cannot throw arg since it was not yet invoked.`, ); }); delegateToCalls(spyApi, "yield", false, "yield", true, function () { throw new Error( - `${this.toString()} cannot yield since it was not yet invoked.` + `${this.toString()} cannot yield since it was not yet invoked.`, ); }); // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode. spyApi.invokeCallback = spyApi.yield; delegateToCalls(spyApi, "yieldOn", false, "yieldOn", true, function () { throw new Error( - `${this.toString()} cannot yield since it was not yet invoked.` + `${this.toString()} cannot yield since it was not yet invoked.`, ); }); delegateToCalls(spyApi, "yieldTo", false, "yieldTo", true, function (property) { throw new Error( `${this.toString()} cannot yield to '${valueToString( - property - )}' since it was not yet invoked.` + property, + )}' since it was not yet invoked.`, ); }); delegateToCalls( @@ -124,10 +124,10 @@ delegateToCalls( function (property) { throw new Error( `${this.toString()} cannot yield to '${valueToString( - property - )}' since it was not yet invoked.` + property, + )}' since it was not yet invoked.`, ); - } + }, ); function createSpy(func) { diff --git a/lib/sinon/stub.js b/lib/sinon/stub.js index beec9d924..8b9efc9b6 100644 --- a/lib/sinon/stub.js +++ b/lib/sinon/stub.js @@ -39,7 +39,7 @@ function createStub(originalFunc) { return ( a.matchingArguments.length - b.matchingArguments.length ); - }) + }), ) || proxy; return getCurrentBehavior(fnStub).invoke(this, arguments); } @@ -68,7 +68,7 @@ function createStub(originalFunc) { function stub(object, property) { if (arguments.length > 2) { throw new TypeError( - "stub(obj, 'meth', fn) has been removed, see documentation" + "stub(obj, 'meth', fn) has been removed, see documentation", ); } @@ -80,7 +80,7 @@ function stub(object, property) { if (isNonExistentProperty(object, property)) { throw new TypeError( - `Cannot stub non-existent property ${valueToString(property)}` + `Cannot stub non-existent property ${valueToString(property)}`, ); } @@ -136,17 +136,17 @@ function assertValidPropertyDescriptor(descriptor, property) { } if (descriptor.isOwn && !descriptor.configurable && !descriptor.writable) { throw new TypeError( - `Descriptor for property ${property} is non-configurable and non-writable` + `Descriptor for property ${property} is non-configurable and non-writable`, ); } if ((descriptor.get || descriptor.set) && !descriptor.configurable) { throw new TypeError( - `Descriptor for accessor property ${property} is non-configurable` + `Descriptor for accessor property ${property} is non-configurable`, ); } if (isDataDescriptor(descriptor) && !descriptor.writable) { throw new TypeError( - `Descriptor for data property ${property} is non-writable` + `Descriptor for data property ${property} is non-writable`, ); } } diff --git a/lib/sinon/throw-on-falsy-object.js b/lib/sinon/throw-on-falsy-object.js index 9f45ddc30..173082edf 100644 --- a/lib/sinon/throw-on-falsy-object.js +++ b/lib/sinon/throw-on-falsy-object.js @@ -5,7 +5,7 @@ function throwOnFalsyObject(object, property) { if (property && !object) { const type = object === null ? "null" : "undefined"; throw new Error( - `Trying to stub property '${valueToString(property)}' of ${type}` + `Trying to stub property '${valueToString(property)}' of ${type}`, ); } } diff --git a/lib/sinon/util/core/export-async-behaviors.js b/lib/sinon/util/core/export-async-behaviors.js index 8fa7b95a0..49caa2628 100644 --- a/lib/sinon/util/core/export-async-behaviors.js +++ b/lib/sinon/util/core/export-async-behaviors.js @@ -12,7 +12,7 @@ module.exports = function exportAsyncBehaviors(behaviorMethods) { acc[`${method}Async`] = function () { const result = behaviorMethods[method].apply( this, - arguments + arguments, ); this.callbackAsync = true; return result; @@ -20,6 +20,6 @@ module.exports = function exportAsyncBehaviors(behaviorMethods) { } return acc; }, - {} + {}, ); }; diff --git a/lib/sinon/util/core/extend.js b/lib/sinon/util/core/extend.js index e5bc99b15..7ec4cf493 100644 --- a/lib/sinon/util/core/extend.js +++ b/lib/sinon/util/core/extend.js @@ -99,11 +99,11 @@ module.exports = function extend(target, ...sources) { function copyValue(dest, source, prop) { const destOwnPropertyDescriptor = Object.getOwnPropertyDescriptor( dest, - prop + prop, ); const sourceOwnPropertyDescriptor = Object.getOwnPropertyDescriptor( source, - prop + prop, ); if (prop === "name" && !destOwnPropertyDescriptor.writable) { @@ -133,7 +133,7 @@ module.exports = function extend(target, ...sources) { } } Object.defineProperty(dest, prop, descriptors); - } + }, ); }; @@ -156,6 +156,6 @@ module.exports.nonEnum = function extendNonEnum(target, ...sources) { configurable: true, writable: true, }); - } + }, ); }; diff --git a/lib/sinon/util/core/get-property-descriptor.js b/lib/sinon/util/core/get-property-descriptor.js index 125619724..df82ba60c 100644 --- a/lib/sinon/util/core/get-property-descriptor.js +++ b/lib/sinon/util/core/get-property-descriptor.js @@ -26,7 +26,7 @@ function getPropertyDescriptor(object, property) { let proto = object; let descriptor; const isOwn = Boolean( - object && Object.getOwnPropertyDescriptor(object, property) + object && Object.getOwnPropertyDescriptor(object, property), ); while ( diff --git a/lib/sinon/util/core/is-non-existent-property.js b/lib/sinon/util/core/is-non-existent-property.js index f72451ade..842c13d8d 100644 --- a/lib/sinon/util/core/is-non-existent-property.js +++ b/lib/sinon/util/core/is-non-existent-property.js @@ -7,7 +7,7 @@ */ function isNonExistentProperty(object, property) { return Boolean( - object && typeof property !== "undefined" && !(property in object) + object && typeof property !== "undefined" && !(property in object), ); } diff --git a/lib/sinon/util/core/walk-object.js b/lib/sinon/util/core/walk-object.js index 2503e3ca2..a5dadc9b3 100644 --- a/lib/sinon/util/core/walk-object.js +++ b/lib/sinon/util/core/walk-object.js @@ -19,7 +19,7 @@ function walkObject(mutator, object, filter) { if (!object) { throw new Error( - `Trying to ${name} object but received ${String(object)}` + `Trying to ${name} object but received ${String(object)}`, ); } @@ -45,7 +45,7 @@ function walkObject(mutator, object, filter) { if (!called) { throw new Error( - `Found no methods on object to which we could apply mutations` + `Found no methods on object to which we could apply mutations`, ); } diff --git a/lib/sinon/util/core/wrap-method.js b/lib/sinon/util/core/wrap-method.js index 992b18d0d..38ab12023 100644 --- a/lib/sinon/util/core/wrap-method.js +++ b/lib/sinon/util/core/wrap-method.js @@ -50,7 +50,7 @@ module.exports = function wrapMethod(object, property, method) { if (typeof method !== "function" && typeof method !== "object") { throw new TypeError( - "Method wrapper should be a function or a property descriptor" + "Method wrapper should be a function or a property descriptor", ); } @@ -60,21 +60,21 @@ module.exports = function wrapMethod(object, property, method) { if (!isFunction(wrappedMethod)) { error = new TypeError( `Attempted to wrap ${typeof wrappedMethod} property ${valueToString( - property - )} as function` + property, + )} as function`, ); } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) { error = new TypeError( `Attempted to wrap ${valueToString( - property - )} which is already wrapped` + property, + )} which is already wrapped`, ); } else if (wrappedMethod.calledBefore) { const verb = wrappedMethod.returns ? "stubbed" : "spied on"; error = new TypeError( `Attempted to wrap ${valueToString( - property - )} which is already ${verb}` + property, + )} which is already ${verb}`, ); } @@ -109,14 +109,14 @@ module.exports = function wrapMethod(object, property, method) { if (!wrappedMethodDesc) { error = new TypeError( - `Attempted to wrap ${typeof wrappedMethod} property ${property} as function` + `Attempted to wrap ${typeof wrappedMethod} property ${property} as function`, ); } else if ( wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon ) { error = new TypeError( - `Attempted to wrap ${property} which is already wrapped` + `Attempted to wrap ${property} which is already wrapped`, ); } if (error) { diff --git a/lib/sinon/util/fake-timers.js b/lib/sinon/util/fake-timers.js index 66478ab54..52c07fdc5 100644 --- a/lib/sinon/util/fake-timers.js +++ b/lib/sinon/util/fake-timers.js @@ -65,7 +65,7 @@ exports.useFakeTimers = function (dateOrConfig) { } throw new TypeError( - "useFakeTimers expected epoch or config object. See https://github.com/sinonjs/sinon" + "useFakeTimers expected epoch or config object. See https://github.com/sinonjs/sinon", ); }; diff --git a/test/assert-test.js b/test/assert-test.js index 4dbfdae80..30bbd4737 100644 --- a/test/assert-test.js +++ b/test/assert-test.js @@ -71,7 +71,7 @@ describe("assert", function () { }, { name: "AssertError", - } + }, ); }); @@ -82,7 +82,7 @@ describe("assert", function () { function () { sinonAssert.fail("Some message"); }, - { name: "CustomError" } + { name: "CustomError" }, ); }); }); @@ -794,7 +794,7 @@ describe("assert", function () { }); assert( - this.stub.calledWithExactly.calledWithExactly(object, 1) + this.stub.calledWithExactly.calledWithExactly(object, 1), ); assert(sinonAssert.fail.called); }); @@ -809,7 +809,7 @@ describe("assert", function () { }); assert( - this.stub.calledWithExactly.calledWithExactly(object, 1) + this.stub.calledWithExactly.calledWithExactly(object, 1), ); assert.isFalse(sinonAssert.fail.called); }); @@ -863,8 +863,8 @@ describe("assert", function () { assert( this.stub.calledOnceWithExactly.calledOnceWithExactly( object, - 1 - ) + 1, + ), ); assert(sinonAssert.fail.called); }); @@ -881,8 +881,8 @@ describe("assert", function () { assert( this.stub.calledOnceWithExactly.calledOnceWithExactly( object, - 1 - ) + 1, + ), ); assert.isFalse(sinonAssert.fail.called); }); @@ -970,7 +970,10 @@ describe("assert", function () { }); assert( - this.stub.calledOnceWithMatch.calledOnceWithMatch(object, 1) + this.stub.calledOnceWithMatch.calledOnceWithMatch( + object, + 1, + ), ); assert(sinonAssert.fail.called); }); @@ -985,7 +988,10 @@ describe("assert", function () { }); assert( - this.stub.calledOnceWithMatch.calledOnceWithMatch(object, 1) + this.stub.calledOnceWithMatch.calledOnceWithMatch( + object, + 1, + ), ); assert.isFalse(sinonAssert.fail.called); }); @@ -1372,7 +1378,7 @@ describe("assert", function () { { message: "expected spy to have been called at least once but was never called", - } + }, ); }); @@ -1405,7 +1411,7 @@ describe("assert", function () { function () { sinonAssert.expose(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1414,7 +1420,7 @@ describe("assert", function () { function () { sinonAssert.expose(null); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); }); @@ -1435,7 +1441,7 @@ describe("assert", function () { try { sinonAssert[method].apply( sinonAssert, - [].slice.call(arguments, 1) + [].slice.call(arguments, 1), ); } catch (e) { /* We sometimes append stack frames to the message and they @@ -1454,7 +1460,7 @@ describe("assert", function () { it("assert.called exception message", function () { assert.equals( this.message("called", this.obj.doSomething), - "expected doSomething to have been called at least once but was never called" + "expected doSomething to have been called at least once but was never called", ); }); @@ -1463,7 +1469,7 @@ describe("assert", function () { assert.equals( this.message("notCalled", this.obj.doSomething), - "expected doSomething to not have been called but was called once\n doSomething()" + "expected doSomething to not have been called but was called once\n doSomething()", ); }); @@ -1477,7 +1483,7 @@ describe("assert", function () { this.message("notCalled", this.obj.doSomething), "expected doSomething to not have been called " + "but was called 4 times\n doSomething()\n " + - "doSomething()\n doSomething()\n doSomething()" + "doSomething()\n doSomething()\n doSomething()", ); }); @@ -1491,7 +1497,7 @@ describe("assert", function () { this.message("notCalled", this.obj.doSomething), "expected doSomething to not have been called " + "but was called 4 times\n doSomething()\n " + - "doSomething(3)\n doSomething(42, 1)\n doSomething()" + "doSomething(3)\n doSomething(42, 1)\n doSomething()", ); }); @@ -1515,12 +1521,12 @@ describe("assert", function () { "callOrder", this.obj.doSomething, obj.doop, - obj.foo + obj.foo, ); assert.equals( message, - "expected doSomething, doop, foo to be called in order but were called as doop, doSomething, foo" + "expected doSomething, doop, foo to be called in order but were called as doop, doSomething, foo", ); }); @@ -1542,7 +1548,7 @@ describe("assert", function () { assert.equals( message, - "expected doop, foo to be called in order but were called as foo" + "expected doop, foo to be called in order but were called as foo", ); }); @@ -1564,7 +1570,7 @@ describe("assert", function () { assert.equals( message, - "expected doop, foo to be called in order but were called as doop" + "expected doop, foo to be called in order but were called as doop", ); }); @@ -1573,7 +1579,7 @@ describe("assert", function () { assert.equals( this.message("callCount", this.obj.doSomething, 3), - "expected doSomething to be called thrice but was called once\n doSomething()" + "expected doSomething to be called thrice but was called once\n doSomething()", ); }); @@ -1582,7 +1588,7 @@ describe("assert", function () { assert.equals( this.message("callCount", this.obj.doSomething, "3"), - "expected '3' to be a number but was of type string" + "expected '3' to be a number but was of type string", ); }); @@ -1592,7 +1598,7 @@ describe("assert", function () { assert.equals( this.message("calledOnce", this.obj.doSomething), - "expected doSomething to be called once but was called twice\n doSomething()\n doSomething()" + "expected doSomething to be called once but was called twice\n doSomething()\n doSomething()", ); this.obj.doSomething(); @@ -1600,7 +1606,7 @@ describe("assert", function () { assert.equals( this.message("calledOnce", this.obj.doSomething), "expected doSomething to be called once but was called " + - "thrice\n doSomething()\n doSomething()\n doSomething()" + "thrice\n doSomething()\n doSomething()\n doSomething()", ); }); @@ -1609,7 +1615,7 @@ describe("assert", function () { assert.equals( this.message("calledTwice", this.obj.doSomething), - "expected doSomething to be called twice but was called once\n doSomething()" + "expected doSomething to be called twice but was called once\n doSomething()", ); }); @@ -1622,7 +1628,7 @@ describe("assert", function () { assert.equals( this.message("calledThrice", this.obj.doSomething), "expected doSomething to be called thrice but was called 4 times\n" + - " doSomething()\n doSomething()\n doSomething()\n doSomething()" + " doSomething()\n doSomething()\n doSomething()\n doSomething()", ); }); @@ -1648,10 +1654,10 @@ describe("assert", function () { assert.equals( this.message("calledOn", this.obj.doSomething, this.obj), `expected doSomething to be called with ${inspect( - this.obj + this.obj, )} as this but was called with ${inspect(obj)}, ${inspect( - obj2 - )}` + obj2, + )}`, ); }); @@ -1678,10 +1684,10 @@ describe("assert", function () { assert.equals( this.message("alwaysCalledOn", this.obj.doSomething, this.obj), `expected doSomething to always be called with ${inspect( - this.obj + this.obj, )} as this but was called with ${inspect(obj)}, ${inspect( - obj2 - )}, ${inspect(this.obj)}` + obj2, + )}, ${inspect(this.obj)}`, ); }); @@ -1690,7 +1696,7 @@ describe("assert", function () { assert.equals( this.message("calledWithNew", this.obj.doSomething), - "expected doSomething to be called with new" + "expected doSomething to be called with new", ); }); @@ -1700,7 +1706,7 @@ describe("assert", function () { assert.equals( this.message("alwaysCalledWithNew", this.obj.doSomething), - "expected doSomething to always be called with new" + "expected doSomething to always be called with new", ); }); @@ -1710,8 +1716,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, 1, 3, "hey"), `expected doSomething to be called with arguments \n${color.red( - "4" - )} ${color.green("1")} \n3\n${inspect('"hey"')}` + "4", + )} ${color.green("1")} \n3\n${inspect('"hey"')}`, ); }); @@ -1729,8 +1735,8 @@ describe("assert", function () { `Call 2:\n` + `1\n` + `3\n${color.red(inspect('"not"'))} ${color.green( - inspect('"hey"') - )} ` + inspect('"hey"'), + )} `, ); }); @@ -1759,7 +1765,7 @@ describe("assert", function () { const actual = this.message( "calledWith", this.obj.doSomething, - expectedArg + expectedArg, ); /** @@ -1784,7 +1790,7 @@ describe("assert", function () { " second: { nest: true },\n" + " third: [ [Object] ],\n" }${color.red(" mismatchKey: true },\n")}${color.green( - " mismatchKeyX: true },\n" + " mismatchKeyX: true },\n", )} 'fifth' ]` : `${ "expected doSomething to be called with arguments \n" + @@ -1794,7 +1800,7 @@ describe("assert", function () { " second: { nest: true },\n" + " third: [ [Object] ],\n" }${color.red(" mismatchKey: true\n")}${color.green( - " mismatchKeyX: true\n" + " mismatchKeyX: true\n", )} },\n` + ` 'fifth'\n` + `]`; @@ -1808,8 +1814,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, 1, 3), `expected doSomething to be called with arguments \n${color.red( - "4" - )} ${color.green("1")} \n${color.green("3")}` + "4", + )} ${color.green("1")} \n${color.green("3")}`, ); }); @@ -1819,8 +1825,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, 1), `expected doSomething to be called with arguments \n${color.red( - "4" - )} ${color.green("1")} \n${color.red("3")}` + "4", + )} ${color.green("1")} \n${color.red("3")}`, ); }); @@ -1832,12 +1838,12 @@ describe("assert", function () { "calledWith", this.obj.doSomething, match.any, - false + false, ), `${ "expected doSomething to be called with arguments \n" + "true any\n" - }${color.red("true")} ${color.green("false")} ` + }${color.red("true")} ${color.green("false")} `, ); }); @@ -1847,8 +1853,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, match.defined), `expected doSomething to be called with arguments \n ${color.red( - "defined" - )}` + "defined", + )}`, ); }); @@ -1858,8 +1864,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, match.truthy), `expected doSomething to be called with arguments \n ${color.red( - "truthy" - )}` + "truthy", + )}`, ); }); @@ -1869,8 +1875,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, match.falsy), `expected doSomething to be called with arguments \n${color.green( - "true" - )} ${color.red("falsy")}` + "true", + )} ${color.red("falsy")}`, ); }); @@ -1880,8 +1886,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, match.same(1)), `expected doSomething to be called with arguments \n ${color.red( - "same(1)" - )}` + "same(1)", + )}`, ); }); @@ -1892,8 +1898,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, matcher), `expected doSomething to be called with arguments \n ${color.red( - 'typeOf("string")' - )}` + 'typeOf("string")', + )}`, ); }); @@ -1906,8 +1912,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, matcher), `expected doSomething to be called with arguments \n ${color.red( - "instanceOf(CustomType)" - )}` + "instanceOf(CustomType)", + )}`, ); }); @@ -1918,8 +1924,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, matcher), `expected doSomething to be called with arguments \n ${color.red( - "match(some: value, and: 123)" - )}` + "match(some: value, and: 123)", + )}`, ); }); @@ -1929,8 +1935,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, match(true)), `expected doSomething to be called with arguments \n ${color.red( - "match(true)" - )}` + "match(true)", + )}`, ); }); @@ -1940,8 +1946,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, match(123)), `expected doSomething to be called with arguments \n ${color.red( - "match(123)" - )}` + "match(123)", + )}`, ); }); @@ -1952,8 +1958,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, matcher), `expected doSomething to be called with arguments \n ${color.red( - 'match("Sinon")' - )}` + 'match("Sinon")', + )}`, ); }); @@ -1964,11 +1970,11 @@ describe("assert", function () { this.message( "calledWith", this.obj.doSomething, - match(/[a-z]+/) + match(/[a-z]+/), ), `expected doSomething to be called with arguments \n ${color.red( - "match(/[a-z]+/)" - )}` + "match(/[a-z]+/)", + )}`, ); }); @@ -1983,8 +1989,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, matcher), `expected doSomething to be called with arguments \n ${color.red( - "match(custom)" - )}` + "match(custom)", + )}`, ); }); @@ -1997,11 +2003,11 @@ describe("assert", function () { this.obj.doSomething, 4, 3, - "hey" + "hey", ), `expected doSomething to be called with match \n${color.red( - "1" - )} ${color.green("4")} \n3\n${inspect('"hey"')}` + "1", + )} ${color.green("4")} \n3\n${inspect('"hey"')}`, ); }); @@ -2014,17 +2020,17 @@ describe("assert", function () { "alwaysCalledWith", this.obj.doSomething, 1, - "hey" + "hey", ), `${ "expected doSomething to always be called with arguments \n" + "Call 1:\n" + "1\n" }${color.red("3")} ${color.green( - inspect('"hey"') + inspect('"hey"'), )} \n${color.red(inspect('"hey"'))}\n` + `Call 2:\n` + - `1\n${inspect('"hey"')}` + `1\n${inspect('"hey"')}`, ); }); @@ -2037,17 +2043,17 @@ describe("assert", function () { "alwaysCalledWithMatch", this.obj.doSomething, 1, - "hey" + "hey", ), `${ "expected doSomething to always be called with match \n" + "Call 1:\n" + "1\n" }${color.red("3")} ${color.green( - inspect('"hey"') + inspect('"hey"'), )} \n${color.red(inspect('"hey"'))}\n` + `Call 2:\n` + - `1\n${inspect('"hey"')}` + `1\n${inspect('"hey"')}`, ); }); @@ -2057,8 +2063,8 @@ describe("assert", function () { assert.equals( this.message("calledWithExactly", this.obj.doSomething, 1, 3), `expected doSomething to be called with exact arguments \n1\n3\n${color.red( - inspect('"hey"') - )}` + inspect('"hey"'), + )}`, ); }); @@ -2069,9 +2075,9 @@ describe("assert", function () { this.obj.doSomething, 1, 3, - "bob" + "bob", ), - "expected doSomething to be called once and with exact arguments " + "expected doSomething to be called once and with exact arguments ", ); this.obj.doSomething(4, 3, "bob"); @@ -2081,11 +2087,11 @@ describe("assert", function () { this.obj.doSomething, 1, 3, - "bob" + "bob", ), `expected doSomething to be called once and with exact arguments \n${color.red( - "4" - )} ${color.green("1")} \n3\n${inspect('"bob"')}` + "4", + )} ${color.green("1")} \n3\n${inspect('"bob"')}`, ); this.obj.doSomething(); @@ -2095,8 +2101,8 @@ describe("assert", function () { "expected doSomething to be called once and with exact arguments \n" + "Call 1:\n" }${color.red("4")}\n${color.red("3")}\n${color.red( - inspect('"bob"') - )}\nCall 2:` + inspect('"bob"'), + )}\nCall 2:`, ); }); @@ -2106,8 +2112,8 @@ describe("assert", function () { assert.equals( this.message("calledWith", this.obj.doSomething, "1234"), `expected doSomething to be called with arguments \n${color.red( - 1234 - )} ${color.green(inspect('"1234"'))} ` + 1234, + )} ${color.green(inspect('"1234"'))} `, ); }); @@ -2119,7 +2125,7 @@ describe("assert", function () { this.message("calledWith", this.obj.doSomething, ""); assert.contains( this.message("calledWith", this.obj.doSomething, ""), - '"hey"' + '"hey"', ); }); @@ -2132,7 +2138,7 @@ describe("assert", function () { "alwaysCalledWithExactly", this.obj.doSomething, 1, - 3 + 3, ), `${ "expected doSomething to always be called with exact arguments \n" + @@ -2142,7 +2148,7 @@ describe("assert", function () { }${color.red(inspect('"hey"'))}\n` + `Call 2:\n` + `1\n` + - `3` + `3`, ); }); @@ -2151,7 +2157,7 @@ describe("assert", function () { assert.equals( this.message("neverCalledWith", this.obj.doSomething, 1, 2), - "expected doSomething to never be called with arguments 1, 2\n doSomething(1, 2, 3)" + "expected doSomething to never be called with arguments 1, 2\n doSomething(1, 2, 3)", ); }); @@ -2163,9 +2169,9 @@ describe("assert", function () { "neverCalledWithMatch", this.obj.doSomething, 1, - 2 + 2, ), - "expected doSomething to never be called with match 1, 2\n doSomething(1, 2, 3)" + "expected doSomething to never be called with match 1, 2\n doSomething(1, 2, 3)", ); }); @@ -2175,7 +2181,7 @@ describe("assert", function () { assert.equals( this.message("threw", this.obj.doSomething), - "doSomething did not throw exception\n doSomething(1, 3, 'hey')\n doSomething(1, 3)" + "doSomething did not throw exception\n doSomething(1, 3, 'hey')\n doSomething(1, 3)", ); }); @@ -2185,14 +2191,14 @@ describe("assert", function () { assert.equals( this.message("alwaysThrew", this.obj.doSomething), - "doSomething did not always throw exception\n doSomething(1, 3, 'hey')\n doSomething(1, 3)" + "doSomething did not always throw exception\n doSomething(1, 3, 'hey')\n doSomething(1, 3)", ); }); it("assert.match exception message", function () { assert.equals( this.message("match", { foo: 1 }, [1, 3]), - "expected value to match\n expected = [ 1, 3 ]\n actual = { foo: 1 }" + "expected value to match\n expected = [ 1, 3 ]\n actual = { foo: 1 }", ); }); }); @@ -2228,7 +2234,7 @@ describe("assert", function () { assert.equals( createExceptionMessage("called", obj[symbol]), - "expected Symbol(Something Symbolic) to have been called at least once but was never called" + "expected Symbol(Something Symbolic) to have been called at least once but was never called", ); }); @@ -2242,9 +2248,9 @@ describe("assert", function () { assert.equals( createExceptionMessage("called", obj[symbol]), - "expected Symbol() to have been called at least once but was never called" + "expected Symbol() to have been called at least once but was never called", ); - } + }, ); }); }); diff --git a/test/create-stub-instance-test.js b/test/create-stub-instance-test.js index 1110e5408..623b284ec 100644 --- a/test/create-stub-instance-test.js +++ b/test/create-stub-instance-test.js @@ -32,7 +32,7 @@ describe("createStubInstance", function () { { message: "Found no methods on object to which we could apply mutations", - } + }, ); }); @@ -152,7 +152,7 @@ describe("createStubInstance", function () { foo: createStub().returns(3), }); }, - { message: "Cannot stub foo. Property does not exist!" } + { message: "Cannot stub foo. Property does not exist!" }, ); }); }); diff --git a/test/fake-test.js b/test/fake-test.js index 527a88b68..41bb49b9e 100644 --- a/test/fake-test.js +++ b/test/fake-test.js @@ -11,7 +11,7 @@ referee.add("isProxy", { assert: function assertIsProxy(actual) { if (typeof actual !== "function") { throw new TypeError( - "isProxy expects 'actual' argument to be a Function" + "isProxy expects 'actual' argument to be a Function", ); } @@ -456,7 +456,7 @@ describe("fake", function () { }, { name: "AssertError", - } + }, ); }); diff --git a/test/issues/issues-test.js b/test/issues/issues-test.js index a8b30328c..64eed2c53 100644 --- a/test/issues/issues-test.js +++ b/test/issues/issues-test.js @@ -314,7 +314,7 @@ describe("issues", function () { try { const preDescriptor = Object.getOwnPropertyDescriptor( window, - "innerHeight" + "innerHeight", ); //backup val Object.defineProperty(window, "innerHeight", { value: 10, @@ -363,14 +363,14 @@ describe("issues", function () { it("sets correct firstCall.returnValue", function () { assert.equals( this.stub.withArgs("arg").firstCall.returnValue, - "return value" + "return value", ); }); it("sets correct lastCall.returnValue", function () { assert.equals( this.stub.withArgs("arg").lastCall.returnValue, - "return value" + "return value", ); }); }); @@ -542,7 +542,7 @@ describe("issues", function () { assert.same( originalSetTimeout, globalContext.setTimeout, - "fakeTimers restored" + "fakeTimers restored", ); }); }); @@ -627,12 +627,12 @@ describe("issues", function () { stub.withArgs( sinon.match.any, sinon.match.any, - sinon.match("a") + sinon.match("a"), ).returns("a"); stub.withArgs( sinon.match.any, sinon.match.any, - sinon.match("b") + sinon.match("b"), ).returns("b"); assert.equals(stub({}, [], "a"), "a"); @@ -761,19 +761,19 @@ describe("issues", function () { const originalPropertyDescriptor = Object.getOwnPropertyDescriptor( obj, - "test" + "test", ); sinon.replace(obj, "test", 2); const replacedPropertyDescriptor = Object.getOwnPropertyDescriptor( obj, - "test" + "test", ); sinon.restore(); const restoredPropertyDescriptor = Object.getOwnPropertyDescriptor( obj, - "test" + "test", ); assert.isUndefined(originalPropertyDescriptor); @@ -785,19 +785,19 @@ describe("issues", function () { const obj = createObjectWithPropFromPrototype(); const originalPropertyDescriptor = Object.getOwnPropertyDescriptor( obj, - "test" + "test", ); sinon.stub(obj, "test").value(2); const replacedPropertyDescriptor = Object.getOwnPropertyDescriptor( obj, - "test" + "test", ); sinon.restore(); const restoredPropertyDescriptor = Object.getOwnPropertyDescriptor( obj, - "test" + "test", ); assert.isUndefined(originalPropertyDescriptor); @@ -893,7 +893,7 @@ describe("issues", function () { createInstanceWithWritableUconfigurablePropertyDescriptor(); refute.exception(() => - this.sandbox.stub(o, "aMethod").returns("stubbed") + this.sandbox.stub(o, "aMethod").returns("stubbed"), ); assert.equals("stubbed", o.aMethod()); this.sandbox.restore(); diff --git a/test/mock-test.js b/test/mock-test.js index 5881ae9c0..dc4d4d10a 100644 --- a/test/mock-test.js +++ b/test/mock-test.js @@ -32,7 +32,7 @@ describe("sinonMock", function () { function () { sinonMock.create(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); }); @@ -53,7 +53,7 @@ describe("sinonMock", function () { function () { mock.expects(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -96,7 +96,7 @@ describe("sinonMock", function () { }, { message: "anonymous mock expectation", - } + }, ); }); @@ -142,7 +142,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -165,7 +165,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -184,7 +184,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -204,7 +204,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -225,7 +225,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -245,7 +245,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -260,7 +260,7 @@ describe("sinonMock", function () { function () { expectation.exactly(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -271,7 +271,7 @@ describe("sinonMock", function () { function () { expectation.exactly("12"); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -288,7 +288,7 @@ describe("sinonMock", function () { err.message === "'Symbol(apple pie)' is not a number" ); - } + }, ); } }); @@ -302,7 +302,7 @@ describe("sinonMock", function () { function () { expectation.atLeast(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -313,7 +313,7 @@ describe("sinonMock", function () { function () { expectation.atLeast({}); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -330,7 +330,7 @@ describe("sinonMock", function () { err.message === "'Symbol(apple pie)' is not number" ); - } + }, ); } }); @@ -419,7 +419,7 @@ describe("sinonMock", function () { function () { expectation.atMost(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -430,7 +430,7 @@ describe("sinonMock", function () { function () { expectation.atMost({}); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -447,7 +447,7 @@ describe("sinonMock", function () { err.message === "'Symbol(apple pie)' is not number" ); - } + }, ); } }); @@ -490,7 +490,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); assert.isFalse(this.expectation.met()); @@ -534,7 +534,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); }); @@ -591,7 +591,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -603,7 +603,7 @@ describe("sinonMock", function () { function () { expectation(1, 2); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -645,7 +645,7 @@ describe("sinonMock", function () { this.expectation.withArgs( match.number, match.string, - match.func + match.func, ); this.expectation(1, "test", function () { return; @@ -660,13 +660,13 @@ describe("sinonMock", function () { this.expectation.withArgs( match.number, match.string, - match.func + match.func, ); assert.exception( function () { expectation(1, 2, 3); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -689,7 +689,7 @@ describe("sinonMock", function () { it("returns expectation for chaining", function () { assert.same( this.expectation.withExactArgs(1), - this.expectation + this.expectation, ); }); @@ -708,7 +708,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -720,7 +720,7 @@ describe("sinonMock", function () { function () { expectation(1, 2); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -732,7 +732,7 @@ describe("sinonMock", function () { function () { expectation(2, 2, 3); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -744,7 +744,7 @@ describe("sinonMock", function () { function () { expectation(1, 2, 3, 4); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -763,7 +763,7 @@ describe("sinonMock", function () { function () { expectation(1, 2, 3); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); }); @@ -788,7 +788,7 @@ describe("sinonMock", function () { function () { expectation(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -806,7 +806,7 @@ describe("sinonMock", function () { err.message === "method called with Symbol(pear pie) as thisValue, expected Symbol(apple pie)" ); - } + }, ); } }); @@ -831,7 +831,7 @@ describe("sinonMock", function () { function () { expectation.verify(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -844,7 +844,7 @@ describe("sinonMock", function () { }, { message: "Expected myMeth('[...]') once (never called)", - } + }, ); }); }); @@ -886,7 +886,7 @@ describe("sinonMock", function () { function () { mock.verify(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); assert.same(this.object.method, this.method); @@ -905,7 +905,7 @@ describe("sinonMock", function () { message: "Expected method('[...]') thrice (never called)\n" + "Expected method(42, '[...]') once (never called)", - } + }, ); }); @@ -919,7 +919,7 @@ describe("sinonMock", function () { }, { message: "Expected method(42) once (never called)", - } + }, ); }); @@ -934,7 +934,7 @@ describe("sinonMock", function () { }, { message: "Expected method(42) thrice (called once)", - } + }, ); }); @@ -951,7 +951,7 @@ describe("sinonMock", function () { { message: "Unexpected call: method()\n Expected method(42) thrice (never called)", - } + }, ); }); @@ -972,7 +972,7 @@ describe("sinonMock", function () { "Unexpected call: method()\n" + " Expectation met: method(1, '[...]') once\n" + " Expected method(42) thrice (never called)", - } + }, ); }); @@ -990,7 +990,7 @@ describe("sinonMock", function () { { message: "Expected method(42) thrice (never called)\nExpectation met: method(1, '[...]') once", - } + }, ); }); @@ -1005,7 +1005,7 @@ describe("sinonMock", function () { { message: "Expected method('[...]') at least once (never called)", - } + }, ); }); @@ -1024,7 +1024,7 @@ describe("sinonMock", function () { { message: "Unexpected call: method()\n Expectation met: method('[...]') at most twice", - } + }, ); }); @@ -1046,7 +1046,7 @@ describe("sinonMock", function () { "Unexpected call: method(2)\n" + " Expectation met: method('[...]') at least once\n" + " Expectation met: method(2, '[...]') once", - } + }, ); }); @@ -1061,7 +1061,7 @@ describe("sinonMock", function () { { message: "Expected method('[...]') at least once and at most twice (never called)", - } + }, ); }); @@ -1081,7 +1081,7 @@ describe("sinonMock", function () { function () { mock.verify(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -1196,7 +1196,7 @@ describe("sinonMock", function () { function () { assert(mock.verify()); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); }); @@ -1229,7 +1229,7 @@ describe("sinonMock", function () { function () { object.method(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); @@ -1242,7 +1242,7 @@ describe("sinonMock", function () { function () { object.method(); }, - { name: "ExpectationError" } + { name: "ExpectationError" }, ); }); diff --git a/test/promise-test.js b/test/promise-test.js index 757a9968b..2d76c3b83 100644 --- a/test/promise-test.js +++ b/test/promise-test.js @@ -83,7 +83,7 @@ describe("promise", function () { { name: "Error", message: "Promise already resolved", - } + }, ); }); @@ -95,7 +95,7 @@ describe("promise", function () { { name: "Error", message: "Promise already resolved", - } + }, ); }); }); @@ -116,7 +116,7 @@ describe("promise", function () { { name: "Error", message: "Promise already rejected", - } + }, ); }); @@ -128,7 +128,7 @@ describe("promise", function () { { name: "Error", message: "Promise already rejected", - } + }, ); }); }); diff --git a/test/proxy-call-test.js b/test/proxy-call-test.js index 524d58f7f..1cc210293 100644 --- a/test/proxy-call-test.js +++ b/test/proxy-call-test.js @@ -21,7 +21,7 @@ function spyCallSetUp() { this.args, this.returnValue, null, - 0 + 0, ); } @@ -62,7 +62,7 @@ function spyCallCalledTests(method) { const args = this.args; assert.isFalse( - this.call[method](args[0], args[1], args[2], args[3], {}) + this.call[method](args[0], args[1], args[2], args[3], {}), ); }); @@ -138,7 +138,7 @@ describe("sinonSpy.call", function () { [], null, null, - 42 + 42, ); assert.same(call.callId, 42); @@ -151,7 +151,7 @@ describe("sinonSpy.call", function () { return; }, {}, - [] + [], ); }); }); @@ -219,7 +219,7 @@ describe("sinonSpy.call", function () { describe( "call.notCalledWithMatch", // eslint-disable-next-line mocha/no-setup-in-describe - spyCallNotCalledTests("notCalledWithMatch") + spyCallNotCalledTests("notCalledWithMatch"), ); describe("call.calledWithExactly", function () { @@ -229,7 +229,7 @@ describe("sinonSpy.call", function () { const args = this.args; assert( - this.call.calledWithExactly(args[0], args[1], args[2], args[3]) + this.call.calledWithExactly(args[0], args[1], args[2], args[3]), ); }); @@ -242,8 +242,8 @@ describe("sinonSpy.call", function () { args[1], args[2], args[3], - {} - ) + {}, + ), ); }); @@ -257,7 +257,7 @@ describe("sinonSpy.call", function () { const args = this.args; assert.isFalse( - this.call.calledWithExactly(args[0], args[1], args[1]) + this.call.calledWithExactly(args[0], args[1], args[1]), ); }); @@ -270,7 +270,7 @@ describe("sinonSpy.call", function () { [], null, null, - 0 + 0, ); assert(call.calledWithExactly()); @@ -285,7 +285,7 @@ describe("sinonSpy.call", function () { [], null, null, - 0 + 0, ); assert.isFalse(call.calledWithExactly({})); @@ -315,7 +315,7 @@ describe("sinonSpy.call", function () { { message: "Expected argument at position 0 to be a Function, but was number", - } + }, ); }); @@ -326,7 +326,7 @@ describe("sinonSpy.call", function () { function () { call.callArg(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -348,7 +348,7 @@ describe("sinonSpy.call", function () { function () { call.callArg({}); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); }); @@ -379,7 +379,7 @@ describe("sinonSpy.call", function () { { message: "Expected argument at position 0 to be a Function, but was number", - } + }, ); }); @@ -403,7 +403,7 @@ describe("sinonSpy.call", function () { function () { call.callArgOn({}, thisObj); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); }); @@ -460,7 +460,7 @@ describe("sinonSpy.call", function () { function () { call.callArgWith(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -471,7 +471,7 @@ describe("sinonSpy.call", function () { function () { call.callArgWith({}); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); }); @@ -540,7 +540,7 @@ describe("sinonSpy.call", function () { { message: "Expected argument at position 2 to be a Function, but was number", - } + }, ); }); @@ -552,7 +552,7 @@ describe("sinonSpy.call", function () { function () { call.callArgOnWith({}, thisObj); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); }); @@ -636,7 +636,7 @@ describe("sinonSpy.call", function () { }, { message: "spy cannot yield since no callback was passed.", - } + }, ); }); @@ -652,7 +652,7 @@ describe("sinonSpy.call", function () { { message: "somethingAwesome cannot yield since no callback was passed. Received [23, 42]", - } + }, ); }); @@ -720,7 +720,7 @@ describe("sinonSpy.call", function () { [], null, null, - 0 + 0, ); assert.same(call.yield, call.invokeCallback); @@ -752,7 +752,7 @@ describe("sinonSpy.call", function () { }, { message: "spy cannot yield since no callback was passed.", - } + }, ); }); @@ -769,7 +769,7 @@ describe("sinonSpy.call", function () { { message: "somethingAwesome cannot yield since no callback was passed. Received [23, 42]", - } + }, ); }); @@ -860,7 +860,7 @@ describe("sinonSpy.call", function () { { message: "spy cannot yield to 'success' since no callback was passed.", - } + }, ); }); @@ -877,7 +877,7 @@ describe("sinonSpy.call", function () { message: "somethingAwesome cannot yield to 'success' since no callback was passed. " + "Received [23, 42]", - } + }, ); }); @@ -965,7 +965,7 @@ describe("sinonSpy.call", function () { { message: "spy cannot yield to 'success' since no callback was passed.", - } + }, ); }); @@ -981,7 +981,7 @@ describe("sinonSpy.call", function () { { message: "spy cannot yield to 'Symbol(apple pie)' since no callback was passed.", - } + }, ); } }); @@ -1000,7 +1000,7 @@ describe("sinonSpy.call", function () { message: "somethingAwesome cannot yield to 'success' since no callback was passed. " + "Received [23, 42]", - } + }, ); }); @@ -1081,7 +1081,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt()" + "doIt()", ); }); @@ -1091,7 +1091,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt(42)" + "doIt(42)", ); }); @@ -1101,7 +1101,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt(42, 'Hey')" + "doIt(42, 'Hey')", ); }); @@ -1111,7 +1111,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt(42, 'Hey') => 42" + "doIt(42, 'Hey') => 42", ); }); @@ -1121,7 +1121,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt(42, 'Hey') => ''" + "doIt(42, 'Hey') => ''", ); }); @@ -1134,7 +1134,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt() !TypeError(Sinon-provided TypeError)" + "doIt() !TypeError(Sinon-provided TypeError)", ); }); @@ -1149,7 +1149,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt() !TypeError(Oh noes!)" + "doIt() !TypeError(Oh noes!)", ); }); @@ -1161,7 +1161,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt(42)" + "doIt(42)", ); }); @@ -1172,7 +1172,7 @@ describe("sinonSpy.call", function () { assert.equals( object.doIt.getCall(0).toString().replace(/ at.*/g, ""), - "doIt() => 42" + "doIt() => 42", ); }); @@ -1190,7 +1190,7 @@ describe("sinonSpy.call", function () { assert.equals( stub2.getCall(0).toString().replace(/ at.*/g, ""), - "stub(1) => 1" + "stub(1) => 1", ); }); /* eslint-enable consistent-return */ diff --git a/test/proxy-test.js b/test/proxy-test.js index 814a1a2fa..1d47819aa 100644 --- a/test/proxy-test.js +++ b/test/proxy-test.js @@ -79,7 +79,7 @@ describe("proxy", function () { faux(arg); assert.equals( faux.printf("%C").replace(/ at.*/g, ""), - `\n ${expected}` + `\n ${expected}`, ); } @@ -105,7 +105,7 @@ describe("proxy", function () { assert.equals( faux.printf("%C").replace(/ at.*/g, ""), - "\n faux('faux\\ntest')\n faux('faux\\ntest')\n faux('faux\\ntest')" + "\n faux('faux\\ntest')\n faux('faux\\ntest')\n faux('faux\\ntest')", ); faux.resetHistory(); @@ -116,7 +116,7 @@ describe("proxy", function () { assert.equals( faux.printf("%C").replace(/ at.*/g, ""), - "\n faux('test')\n faux('faux\\ntest')\n faux('faux\\ntest')" + "\n faux('test')\n faux('faux\\ntest')\n faux('faux\\ntest')", ); }); }); @@ -142,7 +142,7 @@ describe("proxy", function () { assert.equals( faux.printf("%*", 1.4567, "a", true, {}, [], undefined, null), - "1.4567, 'a', true, {}, [], undefined, null" + "1.4567, 'a', true, {}, [], undefined, null", ); assert.equals(faux.printf("%*", "a", "b", "c"), "'a', 'b', 'c'"); }); @@ -162,10 +162,10 @@ describe("proxy", function () { assert.equals( faux.printf("%D"), `\n${color.red("1")}\n${color.red("'\"a\"'")}\n${color.red( - "true" + "true", )}\n${color.red("false")}\n${color.red("[]")}\n${color.red( - "{}" - )}\n${color.red("null")}\n${color.red("undefined")}` + "{}", + )}\n${color.red("null")}\n${color.red("undefined")}`, ); }); @@ -187,12 +187,12 @@ describe("proxy", function () { assert.equals( faux.printf("%D"), `${"\nCall 1:\n"}${color.red("1")}\n${color.red( - "'\"a\"'" + "'\"a\"'", )}\n${color.red("true")}\nCall 2:` + `\n${color.red("false")}\n${color.red( - "[]" + "[]", )}\n${color.red("{}")}\nCall 3:` + - `\n${color.red("null")}\n${color.red("undefined")}` + `\n${color.red("null")}\n${color.red("undefined")}`, ); }); diff --git a/test/restore-object-test.js b/test/restore-object-test.js index 8a600aef8..adb4ce76a 100644 --- a/test/restore-object-test.js +++ b/test/restore-object-test.js @@ -18,21 +18,21 @@ describe("restore-object", function () { function () { restoreObject(false); }, - { message: "Trying to restore object but received false" } + { message: "Trying to restore object but received false" }, ); assert.exception( function () { restoreObject(null); }, - { message: "Trying to restore object but received null" } + { message: "Trying to restore object but received null" }, ); assert.exception( function () { restoreObject(); }, - { message: "Trying to restore object but received undefined" } + { message: "Trying to restore object but received undefined" }, ); }); @@ -47,7 +47,7 @@ describe("restore-object", function () { { message: "Found no methods on object to which we could apply mutations", - } + }, ); }); diff --git a/test/sandbox-test.js b/test/sandbox-test.js index 29aadae9a..28b8f77c7 100644 --- a/test/sandbox-test.js +++ b/test/sandbox-test.js @@ -121,7 +121,7 @@ describe("Sandbox", function () { return; }, }, - "method" + "method", ); this.sandbox.stub( { @@ -129,7 +129,7 @@ describe("Sandbox", function () { return; }, }, - "method" + "method", ); assert.equals(fakes.length, 2); @@ -228,7 +228,7 @@ describe("Sandbox", function () { { name: "TypeError", message: "The constructor should be a function.", - } + }, ); }); @@ -387,7 +387,7 @@ describe("Sandbox", function () { foo: sinonStub().returns(3), }); }, - { message: "Cannot stub foo. Property does not exist!" } + { message: "Cannot stub foo. Property does not exist!" }, ); }); @@ -426,7 +426,7 @@ describe("Sandbox", function () { }, { message: "Trying to stub property 'prop' of null", - } + }, ); }); @@ -441,7 +441,7 @@ describe("Sandbox", function () { { message: "Trying to stub property 'Symbol(apple pie)' of null", - } + }, ); } }); @@ -479,7 +479,7 @@ describe("Sandbox", function () { return; }, }, - "method" + "method", ); this.sandbox.stub( { @@ -487,7 +487,7 @@ describe("Sandbox", function () { return; }, }, - "method" + "method", ); assert.equals(fakes.length, 2); @@ -629,7 +629,7 @@ describe("Sandbox", function () { message: "Cannot stub non-existent property Symbol(apple pie)", }, - TypeError + TypeError, ); deprecated.printWarning = originalPrintWarning; @@ -865,7 +865,7 @@ describe("Sandbox", function () { message: "Cannot define the already existing property existingValue. Perhaps you meant sandbox.replace()?", name: "TypeError", - } + }, ); assert.exception( @@ -873,14 +873,14 @@ describe("Sandbox", function () { sandbox.define( object, "existingFunction", - () => "new function" + () => "new function", ); }, { message: "Cannot define the already existing property existingFunction. Perhaps you meant sandbox.replace()?", name: "TypeError", - } + }, ); // Verify that the methods above, even though they failed, did not replace the values @@ -961,7 +961,7 @@ describe("Sandbox", function () { message: "Cannot replace non-existent property i-dont-exist. Perhaps you meant sandbox.define()?", name: "TypeError", - } + }, ); }); @@ -978,7 +978,7 @@ describe("Sandbox", function () { { message: "Expected replacement argument to be defined", name: "TypeError", - } + }, ); }); @@ -996,7 +996,7 @@ describe("Sandbox", function () { function () { sandbox.replace(object, "property", replacement); }, - { message: "Cannot replace string with function" } + { message: "Cannot replace string with function" }, ); }); @@ -1013,7 +1013,7 @@ describe("Sandbox", function () { function () { sandbox.replace(object, "property", replacement); }, - { message: "Cannot replace function with string" } + { message: "Cannot replace function with string" }, ); }); @@ -1034,7 +1034,7 @@ describe("Sandbox", function () { { message: "Attempted to replace property which is already replaced", - } + }, ); }); @@ -1053,7 +1053,7 @@ describe("Sandbox", function () { { message: "Attempted to replace property which is already replaced", - } + }, ); }); @@ -1067,7 +1067,7 @@ describe("Sandbox", function () { const actual = this.sandbox.replace( object, "property", - replacement + replacement, ); assert.equals(actual, replacement); @@ -1089,7 +1089,7 @@ describe("Sandbox", function () { { message: "Use sandbox.replaceGetter for replacing getters", - } + }, ); }); }); @@ -1111,7 +1111,7 @@ describe("Sandbox", function () { { message: "Use sandbox.replaceSetter for replacing setters", - } + }, ); }); }); @@ -1155,7 +1155,7 @@ describe("Sandbox", function () { this.sandbox.replaceGetter( object, "foo", - sinonFake.returns(expected) + sinonFake.returns(expected), ); assert.equals(object.foo, expected); @@ -1172,7 +1172,7 @@ describe("Sandbox", function () { const actual = this.sandbox.replaceGetter( object, "foo", - replacement + replacement, ); assert.equals(actual, replacement); @@ -1208,7 +1208,7 @@ describe("Sandbox", function () { message: "Cannot replace non-existent property i-dont-exist", name: "TypeError", - } + }, ); }); @@ -1228,7 +1228,7 @@ describe("Sandbox", function () { { message: "`object.property` is not a getter", name: "Error", - } + }, ); }); @@ -1249,7 +1249,7 @@ describe("Sandbox", function () { { message: "Expected replacement argument to be a function", - } + }, ); }); }); @@ -1265,7 +1265,7 @@ describe("Sandbox", function () { this.sandbox.replaceGetter( object, "foo", - sinonFake.returns(expected) + sinonFake.returns(expected), ); this.sandbox.restore(); @@ -1288,13 +1288,13 @@ describe("Sandbox", function () { sandbox.replaceGetter( object, "foo", - sinonFake.returns("two") + sinonFake.returns("two"), ); }, { message: "Attempted to replace foo which is already replaced", - } + }, ); }); }); @@ -1336,7 +1336,7 @@ describe("Sandbox", function () { const actual = this.sandbox.replaceSetter( object, "foo", - replacement + replacement, ); assert.equals(actual, replacement); @@ -1374,7 +1374,7 @@ describe("Sandbox", function () { message: "Cannot replace non-existent property i-dont-exist", name: "TypeError", - } + }, ); }); @@ -1393,7 +1393,7 @@ describe("Sandbox", function () { { message: "`object.property` is not a setter", name: "Error", - } + }, ); }); @@ -1415,7 +1415,7 @@ describe("Sandbox", function () { { message: "Expected replacement argument to be a function", - } + }, ); }); }); @@ -1456,13 +1456,13 @@ describe("Sandbox", function () { sandbox.replaceSetter( object, "foo", - sinonFake.returns("two") + sinonFake.returns("two"), ); }, { message: "Attempted to replace foo which is already replaced", - } + }, ); }); }); @@ -1601,7 +1601,7 @@ describe("Sandbox", function () { it("passes arguments to sinon.useFakeTimers", function () { const useFakeTimersStub = sinonStub( sinonClock, - "useFakeTimers" + "useFakeTimers", ).returns({}); this.sandbox.useFakeTimers({ toFake: ["Date", "setTimeout"] }); @@ -1610,12 +1610,14 @@ describe("Sandbox", function () { }); assert( - useFakeTimersStub.calledWith({ toFake: ["Date", "setTimeout"] }) + useFakeTimersStub.calledWith({ + toFake: ["Date", "setTimeout"], + }), ); assert( useFakeTimersStub.calledWith({ toFake: ["setTimeout", "clearTimeout", "setInterval"], - }) + }), ); useFakeTimersStub.restore(); @@ -1643,7 +1645,7 @@ describe("Sandbox", function () { assert.same( originalSetTimeout, globalContext.setTimeout, - "fakeTimers restored" + "fakeTimers restored", ); }); }); @@ -1905,7 +1907,7 @@ describe("Sandbox", function () { this.obj.replace(myObj, "a", fake); this.obj.replaceGetter(myObj, "b", fake); this.obj.replaceSetter(myObj, "c", fake); - }.bind(this) + }.bind(this), ); }); @@ -2002,7 +2004,7 @@ describe("Sandbox", function () { { message: "sandbox.restore() does not take any parameters. Perhaps you meant stub.restore()", - } + }, ); }); @@ -2054,7 +2056,7 @@ describe("Sandbox", function () { const sandbox = createSandbox( sinonConfig({ properties: ["stub", "mock"], - }) + }), ); assert.equals(sandbox.args.length, 2); @@ -2068,7 +2070,7 @@ describe("Sandbox", function () { const sandbox = createSandbox( sinonConfig({ properties: ["spy", "stub", "mock"], - }) + }), ); assert.spy(sandbox.args[0]()); @@ -2083,7 +2085,7 @@ describe("Sandbox", function () { sinonConfig({ properties: ["server", "stub", "mock"], useFakeServer: false, - }) + }), ); assert.equals(sandbox.args.length, 2); @@ -2104,7 +2106,7 @@ describe("Sandbox", function () { sinonConfig({ properties: ["server", "clock", "spy"], injectInto: object, - }) + }), ); assert.same(object.server, server); @@ -2120,7 +2122,7 @@ describe("Sandbox", function () { const sandbox = createSandbox( sinonConfig({ properties: ["server", "stub", "mock"], - }) + }), ); assert.equals(sandbox.args.length, 3); @@ -2136,12 +2138,12 @@ describe("Sandbox", function () { sinonConfig({ properties: ["server"], useFakeServer: fakeServerWithClock, - }) + }), ); assert.fakeServerWithClock( sandbox.args[0], - this.fakeServer + this.fakeServer, ); sandbox.restore(); @@ -2165,7 +2167,7 @@ describe("Sandbox", function () { const sandbox = createSandbox( sinonConfig({ properties: ["server", "clock"], - }) + }), ); assert.same(sandbox.args[0], this.fakeServer); @@ -2181,7 +2183,7 @@ describe("Sandbox", function () { sinonConfig({ properties: ["server", "clock"], injectInto: object, - }) + }), ); assert.equals(sandbox.args.length, 0); @@ -2203,7 +2205,7 @@ describe("Sandbox", function () { injectInto: object, useFakeTimers: true, useFakeServer: true, - }) + }), ); assert.equals(sandbox.args.length, 0); @@ -2227,13 +2229,13 @@ describe("Sandbox", function () { sinonConfig({ properties: ["clock"], useFakeTimers: { toFake: ["Date", "setTimeout"] }, - }) + }), ); assert( this.useFakeTimersSpy.calledWith({ toFake: ["Date", "setTimeout"], - }) + }), ); sandbox.restore(); @@ -2246,7 +2248,7 @@ describe("Sandbox", function () { sinonConfig({ properties: ["sandbox", "spy"], injectInto: object, - }) + }), ); assert.equals(sandbox.args.length, 0); @@ -2263,7 +2265,7 @@ describe("Sandbox", function () { sinonConfig({ properties: ["match"], injectInto: object, - }) + }), ); assert.same(object.match, match); @@ -2378,14 +2380,14 @@ describe("Sandbox", function () { function () { sandboxA.assert.fail("Some message"); }, - { name: "CustomErrorA" } + { name: "CustomErrorA" }, ); assert.exception( function () { sandboxB.assert.fail("Some message"); }, - { name: "CustomErrorB" } + { name: "CustomErrorB" }, ); sandboxA.restore(); diff --git a/test/shared-spy-stub-everything-tests.js b/test/shared-spy-stub-everything-tests.js index d0cbca106..07cbe0155 100644 --- a/test/shared-spy-stub-everything-tests.js +++ b/test/shared-spy-stub-everything-tests.js @@ -161,9 +161,7 @@ module.exports = function shared(createSpyOrStub) { assert.exception(function () { createSpyOrStub(myObj, "ignoreme"); - }, new TypeError( - "Descriptor for property ignoreme is non-configurable and non-writable" - )); + }, new TypeError("Descriptor for property ignoreme is non-configurable and non-writable")); }); it("throws on accessor property descriptors that are not configurable", function () { @@ -180,9 +178,7 @@ module.exports = function shared(createSpyOrStub) { assert.exception(function () { createSpyOrStub(myObj, "ignoreme"); - }, new TypeError( - "Descriptor for accessor property ignoreme is non-configurable" - )); + }, new TypeError("Descriptor for accessor property ignoreme is non-configurable")); }); it("throws on data descriptors that are not stubbable", function () { @@ -194,8 +190,6 @@ module.exports = function shared(createSpyOrStub) { assert.exception(function () { createSpyOrStub(myObj, "ignoreme"); - }, new TypeError( - "Descriptor for data property ignoreme is non-writable" - )); + }, new TypeError("Descriptor for data property ignoreme is non-writable")); }); }; diff --git a/test/sinon-test.js b/test/sinon-test.js index 167b02bbb..cd3c2dc9d 100644 --- a/test/sinon-test.js +++ b/test/sinon-test.js @@ -56,7 +56,7 @@ describe("sinon module", function () { // Use helper because IE 11 doesn't support the `name` property: assert.equals( functionName(sinon.createSandbox), - "createSandbox" + "createSandbox", ); }); }); @@ -71,7 +71,7 @@ describe("sinon module", function () { it("should be fakeServer.create from nise", function () { assert.equals( sinon.createFakeServer(), - fakeNise.fakeServer.create() + fakeNise.fakeServer.create(), ); }); }); @@ -80,7 +80,7 @@ describe("sinon module", function () { it("should be the fakeServerWithClock export from nise", function () { assert.same( sinon.fakeServerWithClock, - fakeNise.fakeServerWithClock + fakeNise.fakeServerWithClock, ); }); }); @@ -89,7 +89,7 @@ describe("sinon module", function () { it("should be fakeServerWithClock.create from nise", function () { assert.equals( sinon.createFakeServerWithClock(), - fakeNise.fakeServerWithClock.create() + fakeNise.fakeServerWithClock.create(), ); }); }); @@ -104,7 +104,7 @@ describe("sinon module", function () { it("should be the fakeXhr.FakeXMLHttpRequest export from nise", function () { assert.equals( sinon.FakeXMLHttpRequest, - fakeNise.fakeXhr.FakeXMLHttpRequest + fakeNise.fakeXhr.FakeXMLHttpRequest, ); }); }); diff --git a/test/spy-test.js b/test/spy-test.js index d8d0f18b5..fff93e21b 100644 --- a/test/spy-test.js +++ b/test/spy-test.js @@ -396,25 +396,25 @@ describe("spy", function () { ["args", "callId"].forEach(function (propName) { assert.equals( spy.withArgs(1).getCall(0)[propName], - spy.getCall(1)[propName] + spy.getCall(1)[propName], ); assert.equals( spy.withArgs(1).getCall(1)[propName], - spy.getCall(2)[propName] + spy.getCall(2)[propName], ); assert.equals( spy.withArgs(1).getCall(2)[propName], - spy.getCall(3)[propName] + spy.getCall(3)[propName], ); assert.isNull(spy.withArgs(1).getCall(3)); assert.equals( spy.withArgs(1, 1).getCall(0)[propName], - spy.getCall(2)[propName] + spy.getCall(2)[propName], ); assert.isNull(spy.withArgs(1, 1).getCall(1)); assert.equals( spy.withArgs(1, 2).getCall(0)[propName], - spy.getCall(3)[propName] + spy.getCall(3)[propName], ); assert.isNull(spy.withArgs(1, 2).getCall(1)); }); @@ -426,39 +426,39 @@ describe("spy", function () { assert.equals(spy.lastCall.callId, spy.getCall(3).callId); assert.equals( spy.withArgs(1).firstCall.callId, - spy.withArgs(1).getCall(0).callId + spy.withArgs(1).getCall(0).callId, ); assert.equals( spy.withArgs(1).secondCall.callId, - spy.withArgs(1).getCall(1).callId + spy.withArgs(1).getCall(1).callId, ); assert.equals( spy.withArgs(1).thirdCall.callId, - spy.withArgs(1).getCall(2).callId + spy.withArgs(1).getCall(2).callId, ); assert.equals( spy.withArgs(1).lastCall.callId, - spy.withArgs(1).getCall(2).callId + spy.withArgs(1).getCall(2).callId, ); assert.equals( spy.withArgs(1, 1).firstCall.callId, - spy.withArgs(1, 1).getCall(0).callId + spy.withArgs(1, 1).getCall(0).callId, ); assert.isNull(spy.withArgs(1, 1).secondCall); assert.isNull(spy.withArgs(1, 1).thirdCall); assert.equals( spy.withArgs(1, 1).lastCall.callId, - spy.withArgs(1, 1).getCall(0).callId + spy.withArgs(1, 1).getCall(0).callId, ); assert.equals( spy.withArgs(1, 2).firstCall.callId, - spy.withArgs(1, 2).getCall(0).callId + spy.withArgs(1, 2).getCall(0).callId, ); assert.isNull(spy.withArgs(1, 2).secondCall); assert.isNull(spy.withArgs(1, 2).thirdCall); assert.equals( spy.withArgs(1, 2).lastCall.callId, - spy.withArgs(1, 2).getCall(0).callId + spy.withArgs(1, 2).getCall(0).callId, ); } @@ -882,7 +882,7 @@ describe("spy", function () { this.spy.calledOn( match(function (value) { actual = value; - }) + }), ); assert.same(actual, expected); @@ -1116,7 +1116,7 @@ describe("spy", function () { describe( ".alwaysCalledWithMatch", // eslint-disable-next-line mocha/no-setup-in-describe - spyAlwaysCalledTests("alwaysCalledWithMatch") + spyAlwaysCalledTests("alwaysCalledWithMatch"), ); describe(".alwaysCalledWithMatchSpecial", function () { @@ -1171,7 +1171,7 @@ describe("spy", function () { describe( ".neverCalledWithMatch", // eslint-disable-next-line mocha/no-setup-in-describe - spyNeverCalledTests("neverCalledWithMatch") + spyNeverCalledTests("neverCalledWithMatch"), ); describe(".neverCalledWithMatchSpecial", function () { @@ -1292,7 +1292,7 @@ describe("spy", function () { this.spy({ a: 1, b: 2, c: 3 }); assert.isFalse( - this.spy.calledWithExactly({ a: 1, b: 2, c: undefined }) + this.spy.calledWithExactly({ a: 1, b: 2, c: undefined }), ); }); @@ -1300,7 +1300,7 @@ describe("spy", function () { this.spy({ a: 1, b: 2, c: 3 }); assert.isFalse( - this.spy.calledWithExactly({ a: 1, b: 2, c: "blah" }) + this.spy.calledWithExactly({ a: 1, b: 2, c: "blah" }), ); }); @@ -1308,7 +1308,7 @@ describe("spy", function () { this.spy({ a: 1, b: 2, c: 3 }); assert.isFalse( - this.spy.calledWithExactly({ a: 1, b: 2, foo: "blah" }) + this.spy.calledWithExactly({ a: 1, b: 2, foo: "blah" }), ); }); @@ -1316,7 +1316,7 @@ describe("spy", function () { this.spy({ a: 1, b: 2, c: 3 }); assert.isFalse( - this.spy.calledWithExactly({ a: 1, b: 2, foo: undefined }) + this.spy.calledWithExactly({ a: 1, b: 2, foo: undefined }), ); }); @@ -1330,7 +1330,7 @@ describe("spy", function () { this.spy({ a: 1, b: 2, c: 3 }); assert.isFalse( - this.spy.calledWithExactly({ a: 1, b: 2, c: 3, d: 4 }) + this.spy.calledWithExactly({ a: 1, b: 2, c: 3, d: 4 }), ); }); }); @@ -2007,7 +2007,7 @@ describe("spy", function () { assert( this.spyA .getCall(0) - .calledImmediatelyAfter(this.spyB.getCall(0)) + .calledImmediatelyAfter(this.spyB.getCall(0)), ); }); @@ -2065,7 +2065,7 @@ describe("spy", function () { assert( this.spyB .getCall(0) - .calledImmediatelyBefore(this.spyA.getCall(0)) + .calledImmediatelyBefore(this.spyA.getCall(0)), ); }); @@ -2368,7 +2368,7 @@ describe("spy", function () { function () { spy.callArg(1); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -2382,7 +2382,7 @@ describe("spy", function () { { message: "spy cannot call arg since it was not yet invoked.", - } + }, ); }); @@ -2401,7 +2401,7 @@ describe("spy", function () { { message: "someMethod cannot call arg since it was not yet invoked.", - } + }, ); }); @@ -2413,7 +2413,7 @@ describe("spy", function () { function () { spy.callArg(""); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -2475,7 +2475,7 @@ describe("spy", function () { function () { spy.callArgOn(1, thisObj); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -2490,7 +2490,7 @@ describe("spy", function () { { message: "spy cannot call arg since it was not yet invoked.", - } + }, ); }); @@ -2510,7 +2510,7 @@ describe("spy", function () { { message: "someMethod cannot call arg since it was not yet invoked.", - } + }, ); }); @@ -2523,7 +2523,7 @@ describe("spy", function () { function () { spy.callArg("", thisObj); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -2602,7 +2602,7 @@ describe("spy", function () { }, { message: "spy cannot yield since it was not yet invoked.", - } + }, ); }); @@ -2621,7 +2621,7 @@ describe("spy", function () { { message: "someMethod cannot yield since it was not yet invoked.", - } + }, ); }); @@ -2692,7 +2692,7 @@ describe("spy", function () { }, { message: "spy cannot yield since it was not yet invoked.", - } + }, ); }); @@ -2712,7 +2712,7 @@ describe("spy", function () { { message: "someMethod cannot yield since it was not yet invoked.", - } + }, ); }); @@ -2776,7 +2776,7 @@ describe("spy", function () { { message: "spy cannot yield to 'success' since it was not yet invoked.", - } + }, ); }); @@ -2795,7 +2795,7 @@ describe("spy", function () { { message: "someMethod cannot yield to 'success' since it was not yet invoked.", - } + }, ); }); @@ -2813,7 +2813,7 @@ describe("spy", function () { { message: "spy cannot yield to 'Symbol(apple pie)' since it was not yet invoked.", - } + }, ); }); @@ -2877,7 +2877,7 @@ describe("spy", function () { { message: "spy cannot yield to 'success' since it was not yet invoked.", - } + }, ); }); @@ -2897,7 +2897,7 @@ describe("spy", function () { { message: "someMethod cannot yield to 'success' since it was not yet invoked.", - } + }, ); }); @@ -2916,7 +2916,7 @@ describe("spy", function () { { message: "spy cannot yield to 'Symbol(apple pie)' since it was not yet invoked.", - } + }, ); }); @@ -2970,7 +2970,7 @@ describe("spy", function () { error.message === "spy cannot throw arg since it was not yet invoked." ); - } + }, ); }); @@ -2988,7 +2988,7 @@ describe("spy", function () { error.message === "Not enough arguments: 7 required but only 4 present" ); - } + }, ); }); @@ -3006,7 +3006,7 @@ describe("spy", function () { error instanceof TypeError && error.message === expectedError.message ); - } + }, ); }); }); diff --git a/test/stub-test.js b/test/stub-test.js index 977a04120..68f44271d 100644 --- a/test/stub-test.js +++ b/test/stub-test.js @@ -42,7 +42,7 @@ describe("stub", function () { }, { message: "Trying to stub property 'prop' of null", - } + }, ); }); @@ -57,7 +57,7 @@ describe("stub", function () { }, { message: "Trying to stub property 'Symbol(apple pie)' of null", - } + }, ); }); @@ -83,7 +83,7 @@ describe("stub", function () { assert.same( syncVersions, asyncVersions, - "Stub prototype should contain same amount of synchronous and asynchronous methods" + "Stub prototype should contain same amount of synchronous and asynchronous methods", ); }); @@ -522,11 +522,11 @@ describe("stub", function () { const object = {}; stub.resolvesArg(2); - return stub("ignored", "ignored again", object).then(function ( - actual - ) { - assert.same(actual, object); - }); + return stub("ignored", "ignored again", object).then( + function (actual) { + assert.same(actual, object); + }, + ); }); it("should return the same stub", function () { @@ -578,7 +578,7 @@ describe("stub", function () { function () { stub.resolvesArg(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -594,7 +594,7 @@ describe("stub", function () { name: "TypeError", message: "resolvesArg failed: 4 arguments required but only 3 present", - } + }, ); }); }); @@ -629,7 +629,7 @@ describe("stub", function () { function () { stub.returnsArg(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -645,7 +645,7 @@ describe("stub", function () { name: "TypeError", message: "returnsArg failed: 4 arguments required but only 2 present", - } + }, ); }); }); @@ -662,7 +662,7 @@ describe("stub", function () { }, function (err) { return err.message === expectedError.message; - } + }, ); }); @@ -679,7 +679,7 @@ describe("stub", function () { function () { stub.throwsArg(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -695,7 +695,7 @@ describe("stub", function () { name: "TypeError", message: "throwsArg failed: 4 arguments required but only 2 present", - } + }, ); }); @@ -716,7 +716,7 @@ describe("stub", function () { }, function (error) { return error.message === expectedError.message; - } + }, ); }); @@ -742,7 +742,7 @@ describe("stub", function () { }, function (error) { return error.message === expectedError.message; - } + }, ); refute(fakeFn.called); @@ -837,11 +837,11 @@ describe("stub", function () { assert.same(actual, object, "Same object resolved"); assert.isTrue( promise.resolve.calledOnce, - "Custom promise resolve called once" + "Custom promise resolve called once", ); assert.isTrue( promise.resolve.calledWith(object), - "Custom promise resolve called once with expected" + "Custom promise resolve called once with expected", ); }); }); @@ -865,11 +865,11 @@ describe("stub", function () { assert.same(actual, reason, "Same object resolved"); assert.isTrue( promise.reject.calledOnce, - "Custom promise reject called once" + "Custom promise reject called once", ); assert.isTrue( promise.reject.calledWith(reason), - "Custom promise reject called once with expected" + "Custom promise reject called once with expected", ); }); }); @@ -951,7 +951,7 @@ describe("stub", function () { }, { message: "Sinon-provided TypeError", - } + }, ); }); @@ -1061,7 +1061,7 @@ describe("stub", function () { function () { this.stub(1); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1072,7 +1072,7 @@ describe("stub", function () { function () { stub.callsArg(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1083,7 +1083,7 @@ describe("stub", function () { function () { stub.callsArg({}); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1099,7 +1099,7 @@ describe("stub", function () { name: "TypeError", message: "callsArg failed: 4 arguments required but only 2 present", - } + }, ); }); @@ -1160,7 +1160,7 @@ describe("stub", function () { function () { stub.callsArgWith(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1171,7 +1171,7 @@ describe("stub", function () { function () { stub.callsArgWith({}); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1235,7 +1235,7 @@ describe("stub", function () { function () { this.stub(1); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1246,7 +1246,7 @@ describe("stub", function () { function () { stub.callsArgOn(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1257,7 +1257,7 @@ describe("stub", function () { function () { stub.callsArgOn(this.fakeContext, 2); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1367,7 +1367,7 @@ describe("stub", function () { function () { stub.callsArgOnWith(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1378,7 +1378,7 @@ describe("stub", function () { function () { stub.callsArgOnWith({}); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1471,7 +1471,7 @@ describe("stub", function () { message: "stub(obj, 'meth', fn) has been removed, see documentation", }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1645,7 +1645,7 @@ describe("stub", function () { { message: "somethingAwesome expected to yield, but no callback was passed. Received [23, 42]", - } + }, ); }); @@ -1775,7 +1775,7 @@ describe("stub", function () { { message: "somethingAwesome expected to yield, but no callback was passed. Received [23, 42]", - } + }, ); }); @@ -1894,7 +1894,7 @@ describe("stub", function () { function () { this.stub.yieldsOn(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -1913,7 +1913,7 @@ describe("stub", function () { }, }; const stub = createStub(myObj, "somethingAwesome").yieldsOn( - this.fakeContext + this.fakeContext, ); assert.exception( @@ -1923,7 +1923,7 @@ describe("stub", function () { { message: "somethingAwesome expected to yield, but no callback was passed. Received [23, 42]", - } + }, ); }); @@ -2071,7 +2071,7 @@ describe("stub", function () { }, }; const stub = createStub(myObj, "somethingAwesome").yieldsTo( - "success" + "success", ); assert.exception( @@ -2083,7 +2083,7 @@ describe("stub", function () { "somethingAwesome expected to yield to 'success', but " + "no object with such a property was passed. " + "Received [23, 42]", - } + }, ); }); @@ -2236,7 +2236,7 @@ describe("stub", function () { }; const stub = createStub(myObj, "somethingAwesome").yieldsToOn( "success", - this.fakeContext + this.fakeContext, ); assert.exception( @@ -2248,7 +2248,7 @@ describe("stub", function () { "somethingAwesome expected to yield to 'success', but " + "no object with such a property was passed. " + "Received [23, 42]", - } + }, ); }); @@ -2353,7 +2353,7 @@ describe("stub", function () { const fakeFn = createStub().yieldsToOn( "success", this.fakeContext, - 1 + 1, ); const stub = createStub() .callsFake(fakeFn) @@ -2727,7 +2727,7 @@ describe("stub", function () { }, { message: /not supported/, - } + }, ); }); }); diff --git a/test/util/core/walk-object-test.js b/test/util/core/walk-object-test.js index 04dc833fb..2e475e4bf 100644 --- a/test/util/core/walk-object-test.js +++ b/test/util/core/walk-object-test.js @@ -37,7 +37,7 @@ describe("util/core/walk-object", function () { function () { walkObject(fnWithNoName, false); }, - { message: "Trying to fnWithNoName object but received false" } + { message: "Trying to fnWithNoName object but received false" }, ); assert.exception( @@ -47,7 +47,7 @@ describe("util/core/walk-object", function () { { message: "Found no methods on object to which we could apply mutations", - } + }, ); }); @@ -56,7 +56,7 @@ describe("util/core/walk-object", function () { function () { walkObject(anonymousFn, false); }, - { message: "Trying to undefined object but received false" } + { message: "Trying to undefined object but received false" }, ); assert.exception( @@ -66,7 +66,7 @@ describe("util/core/walk-object", function () { { message: "Found no methods on object to which we could apply mutations", - } + }, ); }); }); diff --git a/test/util/core/walk-test.js b/test/util/core/walk-test.js index 2e1905d29..a501def07 100644 --- a/test/util/core/walk-test.js +++ b/test/util/core/walk-test.js @@ -139,7 +139,7 @@ describe("util/core/walk", function () { assert.isNull( err, - `walk tests failed with message '${err && err.message}'` + `walk tests failed with message '${err && err.message}'`, ); }); diff --git a/test/util/core/wrap-method-test.js b/test/util/core/wrap-method-test.js index cc02cc6ae..362372f50 100644 --- a/test/util/core/wrap-method-test.js +++ b/test/util/core/wrap-method-test.js @@ -35,7 +35,7 @@ describe("util/core/wrapMethod", function () { function () { wrapMethod(); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -49,7 +49,7 @@ describe("util/core/wrapMethod", function () { return; }); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -73,7 +73,7 @@ describe("util/core/wrapMethod", function () { err.message === "Attempted to wrap number property Symbol(apple pie) as function" ); - } + }, ); }); @@ -94,7 +94,7 @@ describe("util/core/wrapMethod", function () { }, { message: /Attempted to wrap .* property .* as function/, - } + }, ); }); @@ -105,7 +105,7 @@ describe("util/core/wrapMethod", function () { function () { wrapMethod(object, "method"); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -116,7 +116,7 @@ describe("util/core/wrapMethod", function () { function () { wrapMethod(object, "method", 1); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -138,10 +138,10 @@ describe("util/core/wrapMethod", function () { refute.same( this.getter, - Object.getOwnPropertyDescriptor(this.object, "property").get + Object.getOwnPropertyDescriptor(this.object, "property").get, ); assert.isFunction( - Object.getOwnPropertyDescriptor(this.object, "property").get + Object.getOwnPropertyDescriptor(this.object, "property").get, ); }); @@ -155,10 +155,10 @@ describe("util/core/wrapMethod", function () { refute.same( this.setter, - Object.getOwnPropertyDescriptor(this.object, "property").set + Object.getOwnPropertyDescriptor(this.object, "property").set, ); assert.isFunction( - Object.getOwnPropertyDescriptor(this.object, "property").set + Object.getOwnPropertyDescriptor(this.object, "property").set, ); }); @@ -173,7 +173,7 @@ describe("util/core/wrapMethod", function () { return; }); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -202,7 +202,7 @@ describe("util/core/wrapMethod", function () { err.message === "Attempted to wrap Symbol(apple pie) which is already wrapped" ); - } + }, ); }); @@ -221,7 +221,7 @@ describe("util/core/wrapMethod", function () { }, }); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -234,7 +234,7 @@ describe("util/core/wrapMethod", function () { return; }); }, - { name: "TypeError" } + { name: "TypeError" }, ); }); @@ -258,7 +258,7 @@ describe("util/core/wrapMethod", function () { err.message === "Attempted to wrap Symbol(apple pie) which is already spied on" ); - } + }, ); }); @@ -300,7 +300,7 @@ describe("util/core/wrapMethod", function () { }, { stack: ":STACK2:\n--------------\n:STACK1:", - } + }, ); }); }); diff --git a/test/util/fake-timers-test.js b/test/util/fake-timers-test.js index 98bbad5a1..0b081916e 100644 --- a/test/util/fake-timers-test.js +++ b/test/util/fake-timers-test.js @@ -94,7 +94,7 @@ describe("fakeTimers.clock", function () { { message: "[ERR_INVALID_CALLBACK]: Callback must be a function. Received apple pie of type string", - } + }, ); }); } @@ -694,7 +694,7 @@ describe("fakeTimers.clock", function () { assert.same( date.constructor.prototype, - realDate.constructor.prototype + realDate.constructor.prototype, ); }); @@ -804,7 +804,7 @@ describe("fakeTimers.clock", function () { it("mirrors toUTCString method", function () { assert.same( this.clock.Date.prototype.toUTCString, - Date.prototype.toUTCString + Date.prototype.toUTCString, ); }); @@ -1184,7 +1184,7 @@ describe("fakeTimers.clock", function () { this.clock.restore(); done(); }.bind(this), - 10 + 10, ); }); @@ -1201,7 +1201,7 @@ describe("fakeTimers.clock", function () { this.clock.restore(); done(); }.bind(this), - 10 + 10, ); }); @@ -1215,7 +1215,7 @@ describe("fakeTimers.clock", function () { function () { this.clock.restore(); done(); - }.bind(this) + }.bind(this), ); }); @@ -1227,21 +1227,21 @@ describe("fakeTimers.clock", function () { function () { fakeTimers.useFakeTimers("setImmediate"); }, - { name: "TypeError", message: expectedError } + { name: "TypeError", message: expectedError }, ); assert.exception( function () { fakeTimers.useFakeTimers("setImmediate", "Date"); }, - { name: "TypeError", message: expectedError } + { name: "TypeError", message: expectedError }, ); assert.exception( function () { fakeTimers.useFakeTimers(1000, "setImmediate", "Date"); }, - { name: "TypeError", message: expectedError } + { name: "TypeError", message: expectedError }, ); assert.exception( @@ -1249,10 +1249,10 @@ describe("fakeTimers.clock", function () { fakeTimers.useFakeTimers( new Date(10000000), "setImmediate", - "Date" + "Date", ); }, - { name: "TypeError", message: expectedError } + { name: "TypeError", message: expectedError }, ); });