Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 14ade7f

Browse filesBrowse files
committed
test: html-webpack-plugin integration
1 parent 0ae4443 commit 14ade7f
Copy full SHA for 14ade7f

File tree

Expand file treeCollapse file tree

5 files changed

+286
-9
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+286
-9
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"cache-loader": "^4.1.0",
5252
"css-loader": "^4.3.0",
5353
"file-loader": "^6.1.0",
54+
"html-webpack-plugin": "^4.5.0",
5455
"jest": "^26.4.1",
5556
"jsdom": "^16.4.0",
5657
"lint-staged": "^10.3.0",

‎test/edgeCases.spec.ts

Copy file name to clipboardExpand all lines: test/edgeCases.spec.ts
+18-2Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { bundle, mockBundleAndRun, normalizeNewline } from './utils'
1+
import * as path from 'path'
2+
import HTMLPlugin from 'html-webpack-plugin'
3+
import { mfs, bundle, mockBundleAndRun, normalizeNewline } from './utils'
24

35
// @ts-ignore
46
function assertComponent({
@@ -111,7 +113,21 @@ test('should not duplicate css modules value imports', async () => {
111113
})
112114

113115
// #1213
114-
test.todo('html-webpack-plugin')
116+
test('html-webpack-plugin', async () => {
117+
await bundle({
118+
entry: 'basic.vue',
119+
plugins: [
120+
new HTMLPlugin({
121+
inject: true,
122+
template: path.resolve(__dirname, 'fixtures/index.html'),
123+
filename: 'output.html',
124+
}),
125+
],
126+
})
127+
128+
const html = mfs.readFileSync('/output.html', 'utf-8')
129+
expect(html).toMatch('test.build.js')
130+
})
115131

116132
// #1239
117133
test('usage with null-loader', async () => {

‎test/fixtures/index.html

Copy file name to clipboard
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title></title>
6+
</head>
7+
<body>
8+
</body>
9+
</html>

‎test/utils.ts

Copy file name to clipboardExpand all lines: test/utils.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,5 @@ export function normalizeNewline(input: string): string {
167167
export function genId(fixtureName: string): string {
168168
return hash(path.join('test', 'fixtures', fixtureName).replace(/\\/g, '/'))
169169
}
170+
171+
export { mfs }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.