Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 702 Bytes

File metadata and controls

28 lines (18 loc) · 702 Bytes

vitest/no-interpolation-in-snapshots

📝 Disallow string interpolation in snapshots.

💼⚠️ This rule is enabled in the ✅ recommended config. This rule warns in the 🌐 all config.

🔧 This rule is automatically fixable by the --fix CLI option.

Rule Details

This rule aims to prevent the use of string interpolation in snapshots.

Fail

expect('foo').toMatchSnapshot(`${bar}`)
expect('foo').toMatchSnapshot(`foo ${bar}`)

Pass

expect('foo').toMatchSnapshot()
expect('foo').toMatchSnapshot('foo')
expect('foo').toMatchSnapshot(bar)