diff --git a/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts b/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts index 4b7b410ef6..22c8ffcbeb 100644 --- a/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts +++ b/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts @@ -13,17 +13,13 @@ import { expect.addSnapshotSerializer({ serialize(str: string) { - return ( - str - // Not all package managers print the package.json path in the output - .replace(tmpProjPath(), '') - .replace('/private', '') - .replace('/packages/package-1', '') - // We trim each line to reduce the chances of snapshot flakiness - .split('\n') - .map((r) => r.trim()) - .join('\n') - ); + return str + .replace(/(\r\n|\n)+/g, '\n') + .replace(/\n\s+/g, '\n') + .replace(/\s+\n/g, '\n') + .replace(tmpProjPath(), '') + .replace('/private', '') + .replace('/packages/package-1', ''); }, test(val: string) { return val != null && typeof val === 'string'; @@ -48,12 +44,9 @@ describe('Lerna Smoke Tests', () => { .replace(/Running migration.*\n/g, '') // start of individual migration run .replace(/Ran .* from .*\n .*\n\n/g, '') // end of individual migration run .replace(/No changes were made\n\n/g, ''); // no changes during individual migration run - expect(result).toMatchInlineSnapshot(` - - Lerna No changes were necessary. This workspace is up to date! - - - `); + expect(result).toContain( + 'Lerna No changes were necessary. This workspace is up to date!' + ); }, 1000000); }); @@ -76,18 +69,12 @@ describe('Lerna Smoke Tests', () => { .replace('$ echo test-package-1', '> echo test-package-1'); expect(result).toMatchInlineSnapshot(` - > package-1:print-name + > package-1:print-name + > echo test-package-1 + test-package-1 + Lerna (powered by Nx) Successfully ran target print-name for project package-1 - > echo test-package-1 - test-package-1 - - - - Lerna (powered by Nx) Successfully ran target print-name for project package-1 - - - - `); + `); }, 1000000); }); });