https://github.com/barelyhuman/uvu-inline-snapshot
Minimal Inline Snapshot utility for uvu/assert http://github.com/lukeed/uvu
https://github.com/barelyhuman/uvu-inline-snapshot
inline snapshot snapshot-testing testing uvu
Last synced: about 1 year ago
JSON representation
Minimal Inline Snapshot utility for uvu/assert http://github.com/lukeed/uvu
- Host: GitHub
- URL: https://github.com/barelyhuman/uvu-inline-snapshot
- Owner: barelyhuman
- License: mit
- Created: 2023-10-02T12:31:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-09T06:52:22.000Z (almost 2 years ago)
- Last Synced: 2025-04-15T02:12:40.710Z (about 1 year ago)
- Topics: inline, snapshot, snapshot-testing, testing, uvu
- Language: JavaScript
- Homepage:
- Size: 198 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# uvu-inline-snapshot
> Minimal Inline Snapshot utility for uvu/assert
### Limitations
- Not tested enough with Typescript to confirm that it works with it.
### Installation
```sh
npm i uvu uvu-inline-snapshot
```
### Usage
```js
const { test } = require('uvu')
const { inlineSnapshot } = require('uvu-inline-snapshot')
const add = (x, y) => x + y
test('example 1', async () => {
await inlineSnapshot(add(1, 2), '')
})
test.run()
// --------------------
// will be converted to
const { test } = require('uvu')
const { inlineSnapshot } = require('uvu-inline-snapshot')
const add = (x, y) => x + y
test('example 1', async () => {
await inlineSnapshot(add(1, 2), '3') // Filled for you
})
test.run()
```
To update multiple snapshots, just run the tests with `UVU_SNAPSHOTS=1`
```sh
; UVU_SNAPSHOTS=1 uvu
```
## License
[MIT](/LICENSE)