Skip to content

Commit 29cf6eb

Browse files
committed
Add webpack scenario test.
1 parent f11c317 commit 29cf6eb

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
/test/fixture/unsafe-characters\[*\].mjs
1818
/test/fixture/main-hook/symlink/file/symlink.*js
1919
/test/fixture/scenario/ava-nyc-tsc/*.js
20+
/test/fixture/scenario/webpack/output.js
2021
/test/node_modules/symlink
2122
/test/vendor
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Empty module.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ProvidePlugin } from "webpack"
2+
3+
import assert from "assert"
4+
import { log } from "console"
5+
6+
assert.strictEqual(typeof ProvidePlugin, "function")
7+
8+
log("webpack:true")

test/scenario-tests.mjs

+16
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,22 @@ describe("scenario tests", function () {
196196
))
197197
)
198198

199+
it("should work with webpack", () => {
200+
const dirPath = path.resolve("fixture/scenario/webpack")
201+
const configPath = path.resolve(dirPath, "webpack.config.js")
202+
const entryPath = path.resolve(dirPath, "index.js")
203+
const outputPath = path.resolve(dirPath, "output.js")
204+
205+
return exec("webpack", [
206+
"--config-register", pkgPath,
207+
"--config", configPath,
208+
"--entry", entryPath,
209+
"--mode", "production",
210+
"--output", outputPath
211+
], envAuto)
212+
.then(({ stdout }) => assert.ok(stdout.includes("webpack:true")))
213+
})
214+
199215
it("should work with babel, mocha, and nyc", () => {
200216
const dirPath = path.resolve("fixture/scenario/babel-mocha-nyc")
201217
const cwdPath = path.resolve(dirPath, "cwd.js")

0 commit comments

Comments
 (0)