Skip to content

Commit

Permalink
chore: add html-minifier-terser for test snap
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Jul 18, 2024
1 parent 66d3bd0 commit e7a355e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .changeset/young-shrimps-boil.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
---

feat: add custom unit patch support

chore: use `consola` and `fs-extra`
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@tailwindcss-mangle/shared": "workspace:*",
"@tsconfig/recommended": "^1.0.7",
"@types/fs-extra": "^11.0.4",
"@types/html-minifier-terser": "^7.0.2",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.14.11",
"@vitest/coverage-v8": "^2.0.3",
Expand All @@ -43,6 +44,7 @@
"del": "^7.1.0",
"eslint": "^9.7.0",
"fs-extra": "^11.2.0",
"html-minifier-terser": "^7.2.0",
"local-pkg": "^0.5.0",
"lodash-es": "^4.17.21",
"only-allow": "^1.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1175,15 +1175,15 @@ exports[`vite build > common build change class prefix 2`] = `
`;
exports[`vite build > common build change class prefix 3`] = `
"<!doctype html>
"<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8">
<link rel="icon" type="image/svg+xml" href="/vite.svg">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Vite + TS</title>
<script type="module" crossorigin src="/index.js"></script>
<link rel="stylesheet" crossorigin href="/index.css" />
<link rel="stylesheet" crossorigin href="/index.css">
</head>
<body>
<div id="app"></div>
Expand Down
5 changes: 2 additions & 3 deletions packages/unplugin-tailwindcss-mangle/test/vite.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'node:path'
import { build } from 'vite'
import type { RollupOutput } from 'rollup'
import prettier from 'prettier'
import { minify } from 'html-minifier-terser'
import utwm from '@/vite'

const appRoot = path.resolve(__dirname, 'fixtures/vite-repo')
Expand Down Expand Up @@ -77,8 +77,7 @@ describe('vite build', () => {
}
expect(output[2].type).toBe('asset')
if (output[2].type === 'asset') {
const res = await prettier.format(output[2].source.toString(), {
parser: 'html',
const res = await minify(output[2].source.toString(), {
})
expect(res).toMatchSnapshot()

Check failure on line 82 in packages/unplugin-tailwindcss-mangle/test/vite.test.ts

View workflow job for this annotation

GitHub Actions / Build and Test (windows-latest, 18)

test/vite.test.ts > vite build > common build change class prefix

Error: Snapshot `vite build > common build change class prefix 3` mismatched - Expected + Received @@ -8,8 +8,9 @@ <script type="module" crossorigin src="/index.js"></script> <link rel="stylesheet" crossorigin href="/index.css"> </head> <body> <div id="app"></div> + </body> </html> " ❯ test/vite.test.ts:82:19

Check failure on line 82 in packages/unplugin-tailwindcss-mangle/test/vite.test.ts

View workflow job for this annotation

GitHub Actions / Build and Test (windows-latest, 20)

test/vite.test.ts > vite build > common build change class prefix

Error: Snapshot `vite build > common build change class prefix 3` mismatched - Expected + Received @@ -8,8 +8,9 @@ <script type="module" crossorigin src="/index.js"></script> <link rel="stylesheet" crossorigin href="/index.css"> </head> <body> <div id="app"></div> + </body> </html> " ❯ test/vite.test.ts:82:19
}
Expand Down
54 changes: 33 additions & 21 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e7a355e

Please sign in to comment.