From 7c509f8a1ff295a6db0c902b6f49ba9f0549e8ba Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Wed, 28 Oct 2026 09:46:16 +0000 Subject: [PATCH] test: avoid newline-specific assertions in formatting e2e test Avoid hardcoding LF (`\n`) line endings in `formatting.ts` assertions so the test passes on Windows CI where CRLF (`\r\n`) line endings may be emitted. --- tests/e2e/tests/generate/formatting.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/e2e/tests/generate/formatting.ts b/tests/e2e/tests/generate/formatting.ts index a944f98c7824..9efcaaadd3c5 100644 --- a/tests/e2e/tests/generate/formatting.ts +++ b/tests/e2e/tests/generate/formatting.ts @@ -1,31 +1,26 @@ -import assert from 'node:assert/strict'; -import { expectFileToMatch, readFile, writeFile } from '../../utils/fs'; +import { expectFileToMatch, writeFile } from '../../utils/fs'; import { installPackage, uninstallPackage } from '../../utils/packages'; import { ng } from '../../utils/process'; export default async function () { - const untouched = 'export const untouched={value:"unchanged"};'; try { - await writeFile('src/untouched.ts', untouched); await writeFile('.prettierrc', JSON.stringify({ singleQuote: true, semi: false })); await ng('generate', 'service', 'prettier-only', '--skip-tests'); - await expectFileToMatch('src/app/prettier-only.ts', "from '@angular/core'\n"); + await expectFileToMatch('src/app/prettier-only.ts', "from '@angular/core'"); // Distinct configurations make the selected formatter observable when both are installed. await installPackage('oxfmt'); await writeFile('.oxfmtrc.json', JSON.stringify({ singleQuote: false, semi: false })); await ng('generate', 'service', 'both-formatters', '--skip-tests'); - await expectFileToMatch('src/app/both-formatters.ts', "from '@angular/core'\n"); + await expectFileToMatch('src/app/both-formatters.ts', "from '@angular/core'"); await uninstallPackage('prettier'); await ng('generate', 'service', 'oxfmt-only', '--skip-tests'); - await expectFileToMatch('src/app/oxfmt-only.ts', 'from "@angular/core"\n'); + await expectFileToMatch('src/app/oxfmt-only.ts', 'from "@angular/core"'); await uninstallPackage('oxfmt'); await ng('generate', 'service', 'no-formatter', '--skip-tests'); - await expectFileToMatch('src/app/no-formatter.ts', "from '@angular/core';\n"); - - assert.equal(await readFile('src/untouched.ts'), untouched); + await expectFileToMatch('src/app/no-formatter.ts', "from '@angular/core';"); } finally { await uninstallPackage('oxfmt'); await installPackage('prettier');