diff --git a/packages/snapshot/README.md b/packages/snapshot/README.md index 541712b36067..82643f412c5b 100644 --- a/packages/snapshot/README.md +++ b/packages/snapshot/README.md @@ -19,6 +19,8 @@ const client = new SnapshotClient({ // by default uses fs module, but you can provide your own implementation depending on the environment const environment = new NodeSnapshotEnvironment() +// you need to implement this yourselves, +// this depends on your runner function getCurrentFilepath() { return '/file.spec.ts' } @@ -35,8 +37,6 @@ function wrapper(received) { message, isInline: true, inlineSnapshot, - // you need to implement this yourselves, - // this depends on your runner filepath: getCurrentFilepath(), name: getCurrentTestName(), }) @@ -55,6 +55,12 @@ const options = { await client.startCurrentRun(getCurrentFilepath(), getCurrentTestName(), options) +// this will save snapshot to a file which is returned by "snapshotEnvironment.resolvePath" +client.assert({ + received: 'some text', + isInline: false, +}) + // uses "pretty-format", so it requires quotes // also naming is hard-coded when parsing test files wrapper('text 1').toMatchInlineSnapshot()