Skip to content

[Bug]: regression: inline snapshot indent at col 0 #14556

@rlindner81

Description

@rlindner81

Version

29.7.0

Steps to reproduce

similar behavior was previously reported and fixed in
#9477
#11459

minimal example:

describe("some reason to indent", () => {
  describe("more reason to indent", () => {
    it("inline snap", () => {
      expect([{ foo: 42 }]).toMatchInlineSnapshot(`
[
  {
    "foo": 42,
  },
]
`);
    });
  });
});

as you can see formatting works, but indentation does not work.

Expected behavior

the inline snapshot should be indented properly.

Actual behavior

the inline snapshot is always un-indented, i.e., at col 0

Additional context

  • running prettier 3.0.3 in this project
  • jest configuration prettierPath: null, but removing that makes no difference

Environment

System:
    OS: macOS 13.5.2
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions