Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions packages/vitest/src/integrations/snapshot/chai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ export const SnapshotPlugin: ChaiPlugin = (chai, utils) => {
throw new Error('toMatchInlineSnapshot cannot be used with "not"')
}
const test = getTest('toMatchInlineSnapshot', this)
const isInsideEach = test.each || test.suite?.each
if (isInsideEach) {
throw new Error(
'InlineSnapshot cannot be used inside of test.each or describe.each',
)
}
const expected = utils.flag(this, 'object')
const error = utils.flag(this, 'error')
if (typeof properties === 'string') {
Expand Down Expand Up @@ -211,12 +205,6 @@ export const SnapshotPlugin: ChaiPlugin = (chai, utils) => {
)
}
const test = getTest('toThrowErrorMatchingInlineSnapshot', this)
const isInsideEach = test.each || test.suite?.each
if (isInsideEach) {
throw new Error(
'InlineSnapshot cannot be used inside of test.each or describe.each',
)
}
const expected = utils.flag(this, 'object')
const error = utils.flag(this, 'error')
const promise = utils.flag(this, 'promise') as string | undefined
Expand Down
27 changes: 0 additions & 27 deletions test/cli/fixtures/fails/inline-snapshop-inside-each.test.ts

This file was deleted.

8 changes: 0 additions & 8 deletions test/cli/test/__snapshots__/fails.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ exports[`should fail hooks-timeout-before-hook-cleanup-callback.test.ts 1`] = `
Error: Hook timed out in 102ms."
`;

exports[`should fail inline-snapshop-inside-each.test.ts 1`] = `
"Error: InlineSnapshot cannot be used inside of test.each or describe.each
Error: InlineSnapshot cannot be used inside of test.each or describe.each
Error: InlineSnapshot cannot be used inside of test.each or describe.each
Error: InlineSnapshot cannot be used inside of test.each or describe.each
Error: InlineSnapshot cannot be used inside of test.each or describe.each"
`;

exports[`should fail mock-import-proxy-module.test.ts 1`] = `"Error: There are some problems in resolving the mocks API."`;

exports[`should fail nested-suite.test.ts 1`] = `"AssertionError: expected true to be false // Object.is equality"`;
Expand Down
17 changes: 17 additions & 0 deletions test/snapshots/test/fixtures/inline-multiple-calls/each.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { expect, test, describe } from "vitest";

test.for(["hello", "world"])("test %s", (arg) => {
expect(arg.length).toMatchInlineSnapshot(`5`);
});

describe.for(["hello", "world"])("suite %s", (arg) => {
test("length", () => {
expect(arg.length).toMatchInlineSnapshot(`5`);
});
});

test.for(["hello", "world"])("toThrowErrorMatchingInlineSnapshot %s", (arg) => {
expect(() => {
throw new Error(`length = ${arg.length}`);
}).toThrowErrorMatchingInlineSnapshot(`[Error: length = 5]`)
});
Loading