Skip to content

Commit

Permalink
Merge pull request #285 from iambumblehead/mv-typescript-example-from…
Browse files Browse the repository at this point in the history
…-README-to-wiki

move typescript example from README to wiki
  • Loading branch information
iambumblehead authored Jan 14, 2024
2 parents 44fda68 + 54ae7e4 commit 34cd685
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# changelog

* 2.6.1 _Dec.30.2023_
* 2.6.1 _Jan.14.2023_
* [update ci job to use checkout v4](https://github.com/iambumblehead/esmock/pull/279)
* [update README to work w/ eslint-plugin-markdown](https://github.com/iambumblehead/esmock/pull/275)
* [update eslint](https://github.com/iambumblehead/esmock/pull/276) disallow trailing whitespace
* [add typescript example](https://github.com/iambumblehead/esmock/pull/278) to README
* [update esmock to correctly](https://github.com/iambumblehead/esmock/pull/282) mock builtins imported with `await import` thanks @btakita
* [move typescript example from README](https://github.com/iambumblehead/esmock/pull/283) to wiki
* 2.6.0 _Nov.07.2023_
* [typings: make MockFunction generic,](https://github.com/iambumblehead/esmock/pull/267) thanks @uwinkelvos
* 2.5.9 _Nov.01.2023_
Expand Down
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,6 @@ test('esmock.strict mocks', async () => {
})
```

`esmock` examples in typescript
```ts
import test from 'node:test'
import assert from 'node:assert'
import esmock from 'esmock'
import type Rabbit from '../rabbit.js'

test('specify the type of export returned', async () => {
const rabbit = await esmock<Rabbit>('../rabbit.js', {
'../util.js': {
multiply: (numbers: number[]): number => (
numbers.reduce((acc, n) => acc *= n, 1))
}
})

assert.equal(rabbit.makebabies(), '🐇🐇🐇🐇🐇🐇🐇🐇🐇🐇🐇🐇🐇')
})
```

[0]: https://www.bumblehead.com "bumblehead"
[1]: https://github.com/iambumblehead/esmock/workflows/nodejs-ci/badge.svg "nodejs-ci pipeline"
[2]: https://github.com/iambumblehead/esmock "esmock"
Expand Down

0 comments on commit 34cd685

Please sign in to comment.