From 4595184984b04d0475a12d2c07f5f4a80609e154 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 18 Aug 2026 15:49:50 +0900 Subject: [PATCH] test(snapshot): restore `printBasicPrototype` test (#10979) Co-authored-by: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Co-authored-by: OpenCode --- test/e2e/snapshots/options.test.ts | 44 ++++++++++++++++++++++++++++ test/e2e/snapshots/snapshots.test.ts | 10 ------- 2 files changed, 44 insertions(+), 10 deletions(-) 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( -- 2.51.2