-
-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation for assertion options for the sandbox (#2564)
* doc: improve JSDocs * docs: improve public docs for sandbox - move some important info up where it is more visible - remove some bits no longer relevant (sinon.config) and replace with its modern (post Sinon 1) equivalent * Add example on adding assertOptions to the sandbox
- Loading branch information
Showing
3 changed files
with
84 additions
and
70 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
docs/release-source/release/examples/sandbox-configuration.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require("@fatso83/mini-mocha").install(); | ||
const sinon = require("sinon"); | ||
const { assert } = require("@sinonjs/referee"); | ||
|
||
it("should allow limiting the length of the assert.fake output", function () { | ||
const sb = sinon.createSandbox({ | ||
assertOptions: { | ||
shouldLimitAssertionLogs: true, | ||
assertionLogLimit: 10, | ||
}, | ||
}); | ||
const reallyLongErrorMessage = "a long string repeated 100 times".repeat( | ||
100, | ||
); | ||
|
||
assert.exception( | ||
() => { | ||
sb.assert.fail(reallyLongErrorMessage); | ||
}, | ||
{ | ||
message: "a long str", | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters