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');