Open
Description
Version
29.7.0
Steps to reproduce
test('Surrogate pairs', () => {
expect('π').toBe('π');
});
Expected behavior
expect(received).toBe(expected) // Object.is equality
Expected: "π"
Received: "π"
Actual behavior
Both emojis are made up of surrogate pairs. They have the same high surrogate. When the output contains colors, the low surrogate character is highlighted separately from the high surrogate character, injecting ANSI control sequence characters between the two halves of the surrogate pair, resulting in output like this:
expect(received).toBe(expected) // Object.is equality
Expected: "οΏ½οΏ½"
Received: "οΏ½οΏ½"
Additional context
No response
Environment
System:
OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (8) x64 Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.11.1/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
pnpm: 9.11.0 - ~/.local/share/pnpm/pnpm