Skip to content

Commit ef683fd

Browse files
committed
test: add integration tests for the plugins
1 parent ec4bdd2 commit ef683fd

File tree

20 files changed

+2289
-249
lines changed

20 files changed

+2289
-249
lines changed

cspell.config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ words:
1212
- applellvm
1313
- Astrojs
1414
- buildtools
15+
- Cascadia
1516
- caxa
1617
- ccache
1718
- choco
1819
- cmake
20+
- Consolas
1921
- CPATH
2022
- Cppcheck
2123
- CPPFLAGS
@@ -44,6 +46,7 @@ words:
4446
- msys
4547
- multilib
4648
- mxschmitt
49+
- Neue
4750
- noconfirm
4851
- noprogressbar
4952
- nothrow
@@ -54,6 +57,7 @@ words:
5457
- pnpm
5558
- pwsh
5659
- pypy
60+
- Roboto
5761
- setupcpp
5862
- setx
5963
- Syuu

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,25 @@
1111
"scripts": {
1212
"build": "pnpm -r run build",
1313
"bump": "pnpm exec ncu -u && pnpm -r exec ncu -u && typesync --ignoredeps=dev && pnpm update",
14-
"clean": "shx rm -rf ./packages/*/dist/",
14+
"clean": "shx rm -rf ./packages/*/dist/ ./test/dist/ ./test/.astro",
1515
"doc": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme",
1616
"format": "prettier --write .",
1717
"lint": "eslint . --fix",
1818
"prepare": "pnpm run build",
1919
"publish": "pnpm -r publish",
20-
"test": "run-p test.cspell test.lint",
20+
"test": "run-p test.cspell test.lint && run-s test.posthtml test.htmlnano",
2121
"test.cspell": "cspell lint --no-progress --show-suggestions",
2222
"test.format": "prettier . --check",
23-
"test.lint": "eslint ."
23+
"test.htmlnano": "run-s clean build && cd test && cross-env NODE_ENV=production TEST=htmlnano pnpm build",
24+
"test.lint": "eslint .",
25+
"test.posthtml": "run-s clean build && cd test && cross-env NODE_ENV=production TEST=posthtml pnpm build"
2426
},
2527
"prettier": "prettier-config-atomic",
2628
"devDependencies": {
2729
"@types/node": "22.13.14",
30+
"cross-env": "^7.0.3",
2831
"cspell": "8.18.0",
29-
"eslint": "9.23.0",
32+
"eslint": "^8",
3033
"eslint-config-atomic": "1.22.1",
3134
"npm-check-updates": "17.1.16",
3235
"npm-run-all2": "7.0.2",

packages/astro-htmlnano/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function getAstroHTMLNano(options?: HtmlnanoOptions, preset?: Presets[key
2424
const htmlnanoOptions: HtmlnanoOptions = options ?? {}
2525

2626
// disable `removeComments` due to Astro's use of comments for hydration
27+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
2728
if (htmlnanoOptions.removeComments) {
2829
console.warn("`removeComments` is disabled due to Astro's use of comments for hydration.")
2930
}

packages/astro-posthtml/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import posthtml, { type Options, type Plugin } from "posthtml"
1919
*/
2020
export function getAstroPostHTML<PostHTMLUseThis, PostHTMLMessage>(
2121
plugins?: Plugin<PostHTMLUseThis>[],
22-
options?: Options
22+
options?: Options,
2323
) {
2424
return async (_context: APIContext, next: MiddlewareNext) => {
2525
const response = await next()
@@ -33,7 +33,7 @@ export function getAstroPostHTML<PostHTMLUseThis, PostHTMLMessage>(
3333
// modify HTML using posthtml
3434
const { html: modifiedHTML, messages } = await posthtml<PostHTMLUseThis, PostHTMLMessage>(plugins).process(
3535
originalHTML,
36-
options
36+
options,
3737
)
3838

3939
// log posthtml messages

0 commit comments

Comments
 (0)