Skip to content

Commit

Permalink
Improved test
Browse files Browse the repository at this point in the history
Signed-off-by: Jaid <jaid.jsx@gmail.com>
  • Loading branch information
Jaid committed Jun 19, 2021
1 parent 080f6f9 commit 3a50568
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ module.exports = TestPlugin => {
},
plugins: [
new CleanWebpackPlugin,
new HtmlWebpackPlugin,
new TestPlugin,
new HtmlWebpackPlugin({
templateContent: "<html><body></body></html>",
}),
new TestPlugin({
content: "<main/>",
}),
],
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"babel:test": "rimraf dist/transpiled/test && NODE_ENV=test babel --out-dir dist/transpiled/test src",
"build:prod": "NODE_ENV=production webpack",
"build:dev": "NODE_ENV=development webpack",
"test": "npm run build:prod && NODE_ENV=production MAIN=dist/package/production jest --runInBand --detectOpenHandles",
"test": "npm run build:prod && NODE_ENV=development MAIN=dist/package/production jest --runInBand --detectOpenHandles",
"test:coverage": "npm run test:dev -- --coverage --json --outputFile=dist/jest/stats.json",
"test:debug": "DEBUG=\"$(basename $PWD),$(basename $PWD):*\" NODE_ENV=test node --inspect=9229 node_modules/jest/bin/jest.js --runInBand",
"prepareActionJest": "npm run build:prod"
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ yarn add --dev inject-body-webpack-plugin@^1.2.0



## Example

a



Expand Down
1 change: 0 additions & 1 deletion test/expected.txt

This file was deleted.

3 changes: 1 addition & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ it("should run", async () => {
expect(exists).toBeTruthy()
const htmlOutputFile = path.resolve(outputFile, "..", "index.html")
const output = await fsp.readFile(htmlOutputFile, "utf8")
const expectedContent = await fsp.readFile(path.join(__dirname, "expected.txt"), "utf8")
expect(output).toMatch(expectedContent)
expect(output).toMatch(/<body><main\/><\/body><\/html>$/)
}, ms`1 minute`)

0 comments on commit 3a50568

Please sign in to comment.