Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add links, remove "simply"
  • Loading branch information
mark-wiemer committed Aug 16, 2025
commit 86f777d57873a61be2ba40401bccb192eaedd3ab
4 changes: 2 additions & 2 deletions docs-next/src/content/docs/explainers/spies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: How to use spies with Mocha for testing callbacks and function call
title: Spies
---

Mocha does not come equipped with spies, though libraries like Sinon provide this behaviour if desired. The following is an example of Mocha utilizing Sinon and Should.js to test an EventEmitter:
Mocha does not come equipped with spies, though libraries like [Sinon](https://github.com/sinonjs/sinon) provide this behaviour if desired. The following is an example of Mocha utilizing Sinon and [Should.js](https://github.com/shouldjs/should.js) to test an EventEmitter:

```javascript
var sinon = require('sinon'),
Expand Down Expand Up @@ -33,7 +33,7 @@ describe('EventEmitter', function() {
})
```

The following is the same test, performed without any special spy library, simply utilizing the Mocha `done([err])` callback as a means to assert that the callback has occurred, otherwise resulting in a timeout. Note that Mocha only allows `done()` to be invoked once, and will otherwise error.
The following is the same test, performed without any special spy library, utilizing the Mocha `done([err])` callback as a means to assert that the callback has occurred, otherwise resulting in a timeout. Note that Mocha only allows `done()` to be invoked once, and will otherwise error.

```javascript
describe('EventEmitter', function() {
Expand Down
Loading