Skip to content

Commit

Permalink
Apply Prettier 3 defaults of trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Oct 20, 2023
1 parent 9b69a1f commit 19c779e
Show file tree
Hide file tree
Showing 47 changed files with 568 additions and 572 deletions.
3 changes: 0 additions & 3 deletions CHANGES.md
Expand Up @@ -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
>
> ***
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/_howto/typescript-swc.md
Expand Up @@ -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),
);
```

Expand Down
3 changes: 0 additions & 3 deletions docs/changelog.md
Expand Up @@ -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
>
> ***
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Expand Up @@ -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);
Expand Down
Expand Up @@ -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,
);
});
});
2 changes: 1 addition & 1 deletion docs/release-source/release/fake-xhr-and-server.md
Expand Up @@ -269,7 +269,7 @@ server.respondWith(/\/todo-items\/(\d+)/, function (xhr, id) {
xhr.respond(
200,
{ "Content-Type": "application/json" },
'[{ "id": ' + id + " }]"
'[{ "id": ' + id + " }]",
);
});
```
Expand Down
2 changes: 1 addition & 1 deletion lib/sinon.js
Expand Up @@ -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) {
Expand Down
44 changes: 22 additions & 22 deletions lib/sinon/assert.js
Expand Up @@ -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");
Expand Down Expand Up @@ -151,7 +151,7 @@ function createAssertObject() {
assert.fail(
`${assertionMethod} takes 1 argument but was called with ${
assertionArgs.length + 1
} arguments`
} arguments`,
);
}
break;
Expand Down Expand Up @@ -196,8 +196,8 @@ function createAssertObject() {
this,
(fake.printf || fake.proxy.printf).apply(
fake,
concat([msg], args)
)
concat([msg], args),
),
);
} else {
assert.pass(name);
Expand All @@ -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");
Expand Down
20 changes: 10 additions & 10 deletions lib/sinon/behavior.js
Expand Up @@ -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.`;
}

Expand All @@ -87,7 +87,7 @@ function ensureArgs(name, behavior, args) {
throw new TypeError(
`${name} failed: ${index + 1} arguments required but only ${
args.length
} present`
} present`,
);
}
}
Expand All @@ -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,
);
}
}
Expand Down Expand Up @@ -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);
Expand All @@ -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") {
Expand Down Expand Up @@ -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.",
);
},
};
Expand All @@ -249,7 +249,7 @@ function createBehavior(behaviorMethod) {
this.defaultBehavior = this.defaultBehavior || proto.create(this);
this.defaultBehavior[behaviorMethod].apply(
this.defaultBehavior,
arguments
arguments,
);
return this;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/sinon/create-stub-instance.js
Expand Up @@ -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!`,
);
}
});
Expand Down
8 changes: 4 additions & 4 deletions lib/sinon/default-behaviors.js
Expand Up @@ -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;
Expand Down Expand Up @@ -241,7 +241,7 @@ const defaultBehaviors = {
get: getterFunction,
configurable: isPropertyConfigurable(
rootStub.rootObj,
rootStub.propName
rootStub.propName,
),
});

Expand All @@ -259,9 +259,9 @@ const defaultBehaviors = {
set: setterFunction,
configurable: isPropertyConfigurable(
rootStub.rootObj,
rootStub.propName
rootStub.propName,
),
}
},
);

return fake;
Expand Down

0 comments on commit 19c779e

Please sign in to comment.