diff --git a/packages/vitest/src/integrations/chai/jest-matcher-utils.ts b/packages/vitest/src/integrations/chai/jest-matcher-utils.ts index a3b6d5ce56c0..e0f017f37883 100644 --- a/packages/vitest/src/integrations/chai/jest-matcher-utils.ts +++ b/packages/vitest/src/integrations/chai/jest-matcher-utils.ts @@ -109,6 +109,7 @@ export function stringify(object: unknown, maxDepth = 10, options?: PrettyFormat try { result = prettyFormat(object, { maxDepth, + escapeString: false, // min: true, plugins: PLUGINS, ...options, @@ -118,6 +119,7 @@ export function stringify(object: unknown, maxDepth = 10, options?: PrettyFormat result = prettyFormat(object, { callToJSON: false, maxDepth, + escapeString: false, // min: true, plugins: PLUGINS, ...options, diff --git a/test/core/test/basic.test.ts b/test/core/test/basic.test.ts index b3e30d675a2b..d775423c442b 100644 --- a/test/core/test/basic.test.ts +++ b/test/core/test/basic.test.ts @@ -58,3 +58,8 @@ it.fails('deprecated done callback', (done) => { // @ts-expect-error deprecated done callback is not typed done() }) + +test('escaping', () => { + expect(['\\123']).toEqual(['\\123']) + expect('\\123').toEqual('\\123') +})