From f6fc63a9f4c3a673fa1c54e18c34cace2619e737 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Wed, 4 Nov 2026 10:48:54 +0800 Subject: [PATCH 1/2] test: ensure local tests use freshly built artifacts --- .github/workflows/build.yml | 2 +- package.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69852aa..3e26682 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: run: git diff --exit-code etc/ - name: Run tests - run: pnpm run test + run: pnpm run test:built # Reuses this job's checkout, dependencies, and build. The smoke query # is milliseconds with the binary lookup but catches a linear regression. diff --git a/package.json b/package.json index da092dc..ae62cc7 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,8 @@ "build:dist": "esbuild src/index.ts --bundle --platform=node --format=cjs --outfile=dist/lint-md-parser.cjs --minify && esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/lint-md-parser.mjs --minify && esbuild src/mdx.ts --bundle --platform=node --format=cjs --outfile=dist/lint-md-parser-mdx.cjs --minify && esbuild src/mdx.ts --bundle --platform=node --format=esm --outfile=dist/lint-md-parser-mdx.mjs --minify", "build:ts-declaration": "tsc && api-extractor run --local --verbose && api-extractor run --local --verbose --config api-extractor.mdx.json && cp dist/lint-md-parser.d.ts dist/lint-md-parser.d.cts && cp dist/lint-md-parser.d.ts dist/lint-md-parser.d.mts && cp dist/lint-md-parser-mdx.d.ts dist/lint-md-parser-mdx.d.cts && cp dist/lint-md-parser-mdx.d.ts dist/lint-md-parser-mdx.d.mts && for f in dist/lint-md-parser.d.ts dist/lint-md-parser.d.cts dist/lint-md-parser.d.mts dist/lint-md-parser-mdx.d.ts dist/lint-md-parser-mdx.d.cts dist/lint-md-parser-mdx.d.mts; do cat scripts/mdast-augment.d.ts >> \"$f\"; done", "lint": "eslint --ext js,jsx,ts,tsx ./src", - "test": "jest && pnpm run test:types && pnpm run test:package && pnpm run test:mdx3 && pnpm run test:bench-entry", + "test": "pnpm run build && pnpm run test:built", + "test:built": "jest && pnpm run test:types && pnpm run test:package && pnpm run test:mdx3 && pnpm run test:bench-entry", "test:bench-entry": "node scripts/test-bench-markdown-versions.mjs", "test:mdx3": "node scripts/test-mdx3.mjs", "test:types": "tsc -p __tests__/types/tsconfig.json", @@ -70,7 +71,7 @@ "preprofile:source-map": "pnpm run build", "profile:source-map": "node --expose-gc scripts/profile-source-map-heap.mjs", "test:update": "jest --updateSnapshot", - "prepublishOnly": "pnpm run lint && pnpm run build && pnpm run test" + "prepublishOnly": "pnpm run lint && pnpm run build && pnpm run test:built" }, "devDependencies": { "@attachments/eslint-config": "^0.3.3", From 25ba621bee10d147fb0dbfd75d0fadc62298a46b Mon Sep 17 00:00:00 2001 From: luojiyin Date: Wed, 4 Nov 2026 10:56:00 +0800 Subject: [PATCH 2/2] fix: build before updating test snapshots --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae62cc7..3379543 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "bench:parse": "node scripts/bench-parse.mjs", "preprofile:source-map": "pnpm run build", "profile:source-map": "node --expose-gc scripts/profile-source-map-heap.mjs", - "test:update": "jest --updateSnapshot", + "test:update": "pnpm run build && jest --updateSnapshot", "prepublishOnly": "pnpm run lint && pnpm run build && pnpm run test:built" }, "devDependencies": {