Skip to content

Commit c66c56f

Browse files
lifeartclaude
andcommitted
fix: resolve CI lint errors and add build step for prettier version tests
Fix lint issues in build-externals test (import style, naming conventions, encoding identifier) and add missing `pnpm build` step to test-prettier-versions CI job so the dist file exists when the build-externals test runs. Also make assertions resilient to both CJS and ESM output formats. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2cbbfe5 commit c66c56f

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,6 @@ jobs:
7777

7878
- run: pnpm install --frozen-lockfile
7979

80+
- run: pnpm build
81+
8082
- run: pnpm test
Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
11
import { readFileSync } from 'node:fs';
2-
import { resolve } from 'node:path';
2+
import path from 'node:path';
3+
34
import { describe, expect, test } from 'vitest';
45

56
describe('build externals', () => {
6-
const distPath = resolve(
7+
const distributionPath = path.resolve(
78
import.meta.dirname,
89
'../../dist/prettier-plugin-ember-template-tag.js',
910
);
1011

1112
test('prettier/plugins/estree is externalized, not bundled', () => {
12-
const dist = readFileSync(distPath, 'utf-8');
13+
const distribution = readFileSync(distributionPath, 'utf8');
1314

14-
// The dist should require estree as an external dependency
15-
expect(dist).toContain('require("prettier/plugins/estree")');
15+
// The dist should reference estree as an external dependency (require or import)
16+
expect(distribution).toMatch(
17+
/require\(["']prettier\/plugins\/estree["']\)|from\s+["']prettier\/plugins\/estree["']/,
18+
);
1619

1720
// The dist should NOT contain estree printer internals (canAttachComment is
1821
// a function from the estree printer that would be present if bundled)
19-
expect(dist).not.toMatch(/function\s+\w*canAttachComment/);
22+
expect(distribution).not.toMatch(/function\s+\w*canAttachComment/);
2023
});
2124

2225
test('prettier/plugins/babel is externalized, not bundled', () => {
23-
const dist = readFileSync(distPath, 'utf-8');
26+
const distribution = readFileSync(distributionPath, 'utf8');
2427

25-
expect(dist).toContain('require("prettier/plugins/babel")');
28+
expect(distribution).toMatch(
29+
/require\(["']prettier\/plugins\/babel["']\)|from\s+["']prettier\/plugins\/babel["']/,
30+
);
2631
});
2732
});

0 commit comments

Comments
 (0)