uvu-inline-snapshot

Minimal Inline Snapshot utility for uvu/assert http://github.com/lukeed/uvu

MIT License

Downloads
106
Stars
3
Committers
1

uvu-inline-snapshot

Minimal Inline Snapshot utility for uvu/assert

Limitations

  • Not tested enough with Typescript to confirm that it works with it.

Installation

npm i uvu uvu-inline-snapshot

Usage

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

; UVU_SNAPSHOTS=1 uvu 

License

MIT