|
1 | | -import assert from 'node:assert/strict'; |
2 | | -import { expectFileToMatch, readFile, writeFile } from '../../utils/fs'; |
| 1 | +import { expectFileToMatch, writeFile } from '../../utils/fs'; |
3 | 2 | import { installPackage, uninstallPackage } from '../../utils/packages'; |
4 | 3 | import { ng } from '../../utils/process'; |
5 | 4 |
|
6 | 5 | export default async function () { |
7 | | - const untouched = 'export const untouched={value:"unchanged"};'; |
8 | 6 | try { |
9 | | - await writeFile('src/untouched.ts', untouched); |
10 | 7 | await writeFile('.prettierrc', JSON.stringify({ singleQuote: true, semi: false })); |
11 | 8 | await ng('generate', 'service', 'prettier-only', '--skip-tests'); |
12 | | - await expectFileToMatch('src/app/prettier-only.ts', "from '@angular/core'\n"); |
| 9 | + await expectFileToMatch('src/app/prettier-only.ts', "from '@angular/core'"); |
13 | 10 |
|
14 | 11 | // Distinct configurations make the selected formatter observable when both are installed. |
15 | 12 | await installPackage('oxfmt'); |
16 | 13 | await writeFile('.oxfmtrc.json', JSON.stringify({ singleQuote: false, semi: false })); |
17 | 14 | await ng('generate', 'service', 'both-formatters', '--skip-tests'); |
18 | | - await expectFileToMatch('src/app/both-formatters.ts', "from '@angular/core'\n"); |
| 15 | + await expectFileToMatch('src/app/both-formatters.ts', "from '@angular/core'"); |
19 | 16 |
|
20 | 17 | await uninstallPackage('prettier'); |
21 | 18 | await ng('generate', 'service', 'oxfmt-only', '--skip-tests'); |
22 | | - await expectFileToMatch('src/app/oxfmt-only.ts', 'from "@angular/core"\n'); |
| 19 | + await expectFileToMatch('src/app/oxfmt-only.ts', 'from "@angular/core"'); |
23 | 20 |
|
24 | 21 | await uninstallPackage('oxfmt'); |
25 | 22 | await ng('generate', 'service', 'no-formatter', '--skip-tests'); |
26 | | - await expectFileToMatch('src/app/no-formatter.ts', "from '@angular/core';\n"); |
27 | | - |
28 | | - assert.equal(await readFile('src/untouched.ts'), untouched); |
| 23 | + await expectFileToMatch('src/app/no-formatter.ts', "from '@angular/core';"); |
29 | 24 | } finally { |
30 | 25 | await uninstallPackage('oxfmt'); |
31 | 26 | await installPackage('prettier'); |
|
0 commit comments