diff --git a/src/bun.js/test/expect.zig b/src/bun.js/test/expect.zig index 452ec50811..a7239aefcc 100644 --- a/src/bun.js/test/expect.zig +++ b/src/bun.js/test/expect.zig @@ -2765,7 +2765,7 @@ pub const Expect = struct { } } const end_indent = if (std.mem.lastIndexOfScalar(u8, str_in, '\n')) |c| c + 1 else return give_up_2; // there has to have been at least a single newline to get here - for (str_in[end_indent..]) |c| if (c != ' ' and c != 't') return give_up_2; // we already checked, but the last line is not all whitespace again + for (str_in[end_indent..]) |c| if (c != ' ' and c != '\t') return give_up_2; // we already checked, but the last line is not all whitespace again // done return .{ .trimmed = trimmed_buf[0 .. trimmed_buf.len - dst.len], .start_indent = indent_str, .end_indent = str_in[end_indent..] }; diff --git a/test/js/bun/test/snapshot-tests/snapshots/snapshot.test.ts b/test/js/bun/test/snapshot-tests/snapshots/snapshot.test.ts index d6bda70b82..debc737ef4 100644 --- a/test/js/bun/test/snapshot-tests/snapshots/snapshot.test.ts +++ b/test/js/bun/test/snapshot-tests/snapshots/snapshot.test.ts @@ -847,6 +847,21 @@ indentation" `, ); }); + it("#16403", () => { + tester.test(v => + v( + '\tit(\'should get range of notes\', () => {\n\t\tconst range = ["C2", "B2"];\n\n\t\texpect(range).toMatchInlineSnapshot();\n\t});\n', + '\tit(\'should get range of notes\', () => {\n\t\tconst range = ["C2", "B2"];\n\n\t\texpect(range).toMatchInlineSnapshot(`\n\t\t [\n\t\t "ab",\n\t\t "cd",\n\t\t ]\n\t\t`);\n\t});\n', + '\tit(\'should get range of notes\', () => {\n\t\tconst range = ["C2", "B2"];\n\n\t\texpect(range).toMatchInlineSnapshot(`\n\t\t [\n\t\t "C2",\n\t\t "B2",\n\t\t ]\n\t\t`);\n\t});\n', + ), + ); + tester.testUpdateOnly(v => + v( + '\tit(\'should get range of notes\', () => {\n\t\tconst range = ["C2", "B2"];\n\n\t\texpect(range).toMatchInlineSnapshot(`\n\t\t\t[\n\t\t\t "ab",\n\t\t\t "cd",\n\t\t\t]\n\t\t`);\n\t});\n', + '\tit(\'should get range of notes\', () => {\n\t\tconst range = ["C2", "B2"];\n\n\t\texpect(range).toMatchInlineSnapshot(`\n\t\t\t[\n\t\t\t "C2",\n\t\t\t "B2",\n\t\t\t]\n\t\t`);\n\t});\n', + ), + ); + }); }); test("indented inline snapshots", () => { expect("a\nb").toMatchInlineSnapshot(`