Skip to content

Commit a479ec1

Browse files
committed
ci: add core prettier compatibility matrix
1 parent 9fb32a5 commit a479ec1

7 files changed

Lines changed: 122 additions & 16 deletions

File tree

.github/workflows/compatibility-smoke.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,76 @@ jobs:
103103
- name: Run known-passing formatting fixtures
104104
run: yarn test:formatting:passing
105105

106+
core-formatting:
107+
name: Core formatting fixtures
108+
runs-on: ubuntu-latest
109+
110+
steps:
111+
- name: Check out repository
112+
uses: actions/checkout@v4
113+
114+
- name: Set up Node.js
115+
uses: actions/setup-node@v4
116+
with:
117+
node-version: 20
118+
cache: yarn
119+
120+
- name: Install Vim
121+
run: sudo apt-get update && sudo apt-get install -y vim
122+
123+
- name: Verify Vim capabilities
124+
run: node scripts/vim-version.js
125+
126+
- name: Report Yarn version
127+
run: yarn --version
128+
129+
- name: Install dependencies
130+
run: yarn install --frozen-lockfile
131+
132+
- name: Run core formatting fixtures
133+
run: yarn test:formatting:core
134+
135+
core-formatting-exec:
136+
name: Core formatting fixtures with Prettier ${{ matrix.prettier-version }}
137+
runs-on: ubuntu-latest
138+
139+
strategy:
140+
fail-fast: false
141+
matrix:
142+
prettier-version:
143+
- 2.8.8
144+
- latest
145+
146+
steps:
147+
- name: Check out repository
148+
uses: actions/checkout@v4
149+
150+
- name: Set up Node.js
151+
uses: actions/setup-node@v4
152+
with:
153+
node-version: 20
154+
cache: yarn
155+
156+
- name: Install Vim
157+
run: sudo apt-get update && sudo apt-get install -y vim
158+
159+
- name: Verify Vim capabilities
160+
run: node scripts/vim-version.js
161+
162+
- name: Report Yarn version
163+
run: yarn --version
164+
165+
- name: Install dependencies
166+
run: yarn install --frozen-lockfile
167+
168+
- name: Install matrix Prettier
169+
run: npm install --prefix "$RUNNER_TEMP/prettier-${{ matrix.prettier-version }}" "prettier@${{ matrix.prettier-version }}"
170+
171+
- name: Run core formatting fixtures with matrix Prettier
172+
run: yarn test:formatting:core:exec
173+
env:
174+
PRETTIER_EXEC_CMD_PATH: ${{ runner.temp }}/prettier-${{ matrix.prettier-version }}/node_modules/.bin/prettier
175+
106176
quarantined-formatting-discovery:
107177
name: Quarantined Lua/Ruby formatting discovery
108178
runs-on: ubuntu-latest

AGENTS.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ plugin versions:
139139
Docs now scope measured bundled fallback support to PHP/XML, classify Lua/Ruby
140140
bundled formatting as quarantined failing, and classify Svelte as detected but
141141
unmeasured under the current Prettier 3 baseline.
142+
- Added a core-only formatting fixture lane for CSS, GraphQL, HTML, JS, JSON,
143+
Less, Markdown, SCSS, TS, Vue, and YAML so core formatter coverage is not mixed
144+
with bundled external plugin languages.
145+
- The test harness can set `g:prettier#exec_cmd_path` from
146+
`PRETTIER_EXEC_CMD_PATH`, allowing core fixtures to run against caller-provided
147+
Prettier executables outside this checkout without changing package deps.
148+
- `yarn test:formatting:core` passes against the bundled/current Prettier 3.0.3
149+
baseline, and `PRETTIER_EXEC_CMD_PATH=... yarn test:formatting:core:exec`
150+
passes against a temp Prettier 2.8.8 install outside the repo.
151+
- Normalized the Markdown core fixture away from version-specific list
152+
indentation and validated the core lane against temp Prettier 2.8.8 and
153+
`prettier@latest` installs outside the repo.
154+
- Added a blocking CI core-formatting matrix for caller-provided Prettier 2.8.8
155+
and latest executables outside this checkout.
142156

143157
## Review Findings After b538e29
144158

@@ -178,8 +192,8 @@ plugin versions:
178192
- [x] Split Jest formatting tests into blocking known-passing and quarantined
179193
known-failing lanes.
180194
- [x] Harden CI with explicit Vim version/feature checks and `git diff --check`.
181-
- [ ] Add CI with an editor and Prettier compatibility matrix after smoke lanes
182-
are stable.
195+
- [ ] Add CI with an editor compatibility matrix after smoke lanes are stable.
196+
- [x] Add CI with a Prettier core compatibility matrix.
183197
- [x] Resolve `vint` reproducibility through a pinned container or installable
184198
local deps.
185199
- [ ] Replace or deprecate the current Dockerfile path.
@@ -194,7 +208,10 @@ plugin versions:
194208
string, list, empty, invalid, and paths with spaces.
195209
- [x] Add project-local Prettier tests proving bundled plugin injection does not
196210
override local Prettier/plugins.
197-
- [ ] Validate core Prettier language fixtures on Prettier 2.8.8 and 3.x.
211+
- [x] Validate core Prettier language fixtures on bundled/current Prettier 3.0.3
212+
and project-local Prettier 2.8.8.
213+
- [x] Decide the Prettier latest core snapshot strategy for the Markdown list
214+
indentation delta before adding latest as a blocking target.
198215
- [x] Audit bundled parser-plugin versions for PHP, Ruby, XML, Lua, and Svelte.
199216
- [x] Decide Lua/Ruby/Svelte support policy together before advertising or
200217
removing any plugin-language support.
@@ -235,6 +252,8 @@ plugin versions:
235252

236253
- `yarn install --frozen-lockfile`
237254
- `yarn test`
255+
- `yarn test:formatting:core`
256+
- `PRETTIER_EXEC_CMD_PATH=/path/to/prettier yarn test:formatting:core:exec`
238257
- `yarn lint`
239258
- `git diff --check`
240259

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
"url": "git://github.com/prettier/vim-prettier.git"
1010
},
1111
"scripts": {
12-
"test": "node scripts/vim-version.js && LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=all jest",
13-
"test:smoke": "node scripts/vim-version.js && LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=all jest tests/formatting.test.js --runInBand --testNamePattern=\"Prettier config|Prettier command shell\"",
14-
"test:formatting:passing": "node scripts/vim-version.js && LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=known-passing jest tests/formatting.test.js --runInBand",
15-
"test:formatting:quarantined": "node scripts/vim-version.js && LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=quarantined jest tests/formatting.test.js --runInBand",
12+
"test": "node scripts/vim-version.js && PRETTIER_EXEC_CMD_PATH= LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=all jest",
13+
"test:smoke": "node scripts/vim-version.js && PRETTIER_EXEC_CMD_PATH= LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=all jest tests/formatting.test.js --runInBand --testNamePattern=\"Prettier config|Prettier command shell\"",
14+
"test:formatting:core": "node scripts/vim-version.js && PRETTIER_EXEC_CMD_PATH= LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=core jest tests/formatting.test.js --runInBand",
15+
"test:formatting:core:exec": "node scripts/vim-version.js && node -e \"if (!process.env.PRETTIER_EXEC_CMD_PATH) { console.error('Set PRETTIER_EXEC_CMD_PATH to a Prettier executable'); process.exit(1); }\" && LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=core jest tests/formatting.test.js --runInBand",
16+
"test:formatting:passing": "node scripts/vim-version.js && PRETTIER_EXEC_CMD_PATH= LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=known-passing jest tests/formatting.test.js --runInBand",
17+
"test:formatting:quarantined": "node scripts/vim-version.js && PRETTIER_EXEC_CMD_PATH= LOG_LEVEL=error PRETTIER_FORMATTING_FIXTURE_LANE=quarantined jest tests/formatting.test.js --runInBand",
1618
"lint": "sh scripts/vint.sh --version && sh scripts/vint.sh ."
1719
},
1820
"dependencies": {

tests/__snapshots__/formatting.test.js.snap

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ Lorem ipsum dolor amet
143143
144144
### bar
145145
146-
- a
147-
- b
148-
- c"
146+
A short paragraph."
149147
`;
150148

151149
exports[`Prettier formats foo.md file with :PrettierAsync command 1`] = `
@@ -155,9 +153,7 @@ Lorem ipsum dolor amet
155153
156154
### bar
157155
158-
- a
159-
- b
160-
- c"
156+
A short paragraph."
161157
`;
162158

163159
exports[`Prettier formats foo.php file with :Prettier command 1`] = `

tests/fixtures/foo.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ Lorem ipsum dolor amet
66

77

88

9-
- a
10-
- b
11-
- c
9+
A short paragraph.

tests/formatting.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ const PORT = 1337;
99
const FIXTURES_DIR = `${__dirname}/fixtures`;
1010
const VIMRC = `${__dirname}/vimrc`;
1111
const FORMAT_FIXTURE_LANE = process.env.PRETTIER_FORMATTING_FIXTURE_LANE || 'all';
12+
const CORE_FORMATTING_FIXTURES = new Set([
13+
'foo.css',
14+
'foo.graphql',
15+
'foo.html',
16+
'foo.js',
17+
'foo.json',
18+
'foo.less',
19+
'foo.md',
20+
'foo.scss',
21+
'foo.ts',
22+
'foo.vue',
23+
'foo.yaml',
24+
]);
1225
const QUARANTINED_FORMATTING_FIXTURES = new Set(['foo.lua', 'foo.rb']);
1326
const tempProjectRoots = [];
1427

@@ -21,6 +34,10 @@ const isSelectedFormattingFixture = file => {
2134
return QUARANTINED_FORMATTING_FIXTURES.has(file);
2235
}
2336

37+
if (FORMAT_FIXTURE_LANE === 'core') {
38+
return CORE_FORMATTING_FIXTURES.has(file);
39+
}
40+
2441
if (FORMAT_FIXTURE_LANE === 'all') {
2542
return true;
2643
}

tests/vimrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
let s:plugin_root = fnamemodify(resolve(expand('<sfile>:p')), ':h:h')
44

5+
if exists('$PRETTIER_EXEC_CMD_PATH') && $PRETTIER_EXEC_CMD_PATH !=# ''
6+
let g:prettier#exec_cmd_path = $PRETTIER_EXEC_CMD_PATH
7+
endif
8+
59
if filereadable('/rtp.vim')
610
source /rtp.vim
711
endif

0 commit comments

Comments
 (0)