-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
🐛 Bug Report
When a new inline snapshot is generated in a file that already contains inline snapshots, the new snapshot content is incorrectly indented far left, at column 0.
To Reproduce
The following code upon file save produces a correctly indented snapshot:
test('test', () => {
expect(['Hello world']).toMatchInlineSnapshot()
})Becomes -
test('test', () => {
expect(['Hello world']).toMatchInlineSnapshot(`
Array [
"Hello world",
]
`)
})However, with two test blocks present, the first already containing an inline snapshot -
test('test', () => {
expect(['Hello world']).toMatchInlineSnapshot(`
Array [
"Hello world",
]
`)
})
test('test', () => {
expect(['Hello world']).toMatchInlineSnapshot()
})On save, becomes -
test('test', () => {
expect(['Hello world']).toMatchInlineSnapshot(`
Array [
"Hello world",
]
`)
})
test('test', () => {
expect(['Hello world']).toMatchInlineSnapshot(`
Array [
"Hello world",
]
`)
})Expected behavior
In the second example above, I would expect the snapshot in the second test block to be indented the same as the first, not hard left.
envinfo
System:
OS: macOS 10.15.2
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v12.6.0/bin/npm
npmPackages:
jest: 25.1.0 => 25.1.0