diff --git a/test/e2e/snapshots/options.test.ts b/test/e2e/snapshots/options.test.ts index 9704adac3..c53ac7b4e 100644 --- a/test/e2e/snapshots/options.test.ts +++ b/test/e2e/snapshots/options.test.ts @@ -78,3 +78,47 @@ describe('maxOutputLength', () => { `) }) }) + +test('printBasicPrototype', async () => { + const result = await runInlineTests( + { + 'basic.test.ts': ` + import { expect, test } from 'vitest' + + test('non default snapshot format', () => { + expect({ foo: ['bar'] }).toMatchInlineSnapshot() + }) + `, + }, + { + update: 'all', + snapshotFormat: { + printBasicPrototype: true, + }, + }, + ) + + expect(result.stderr).toBe('') + expect(result.errorTree()).toMatchInlineSnapshot(` + { + "basic.test.ts": { + "non default snapshot format": "passed", + }, + } + `) + expect(result.fs.readFile('basic.test.ts')).toMatchInlineSnapshot(` + " + import { expect, test } from 'vitest' + + test('non default snapshot format', () => { + expect({ foo: ['bar'] }).toMatchInlineSnapshot(\` + Object { + \"foo\": Array [ + \"bar\", + ], + } + \`) + }) + " + `) +}) diff --git a/test/e2e/snapshots/snapshots.test.ts b/test/e2e/snapshots/snapshots.test.ts index 166dcaa13..6e9177ccb 100644 --- a/test/e2e/snapshots/snapshots.test.ts +++ b/test/e2e/snapshots/snapshots.test.ts @@ -3,16 +3,6 @@ import { expect, test } from 'vitest' import { editFile, runInlineTests, runVitest } from '../../test-utils' -test('non default snapshot format', () => { - expect({ foo: ['bar'] }).toMatchInlineSnapshot(` - { - "foo": [ - "bar", - ], - } - `) -}) - test('--update works for workspace project', async () => { // setup wrong snapshot value editFile(