Skip to content

Commit

Permalink
test: try to fix the randomly failed of @rspack/cli test cases (#8030)
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder authored Sep 30, 2024
1 parent 5c261d9 commit bed0b18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/rspack-cli/tests/build/issue-6359/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ it("should not have `process.env.WEBPACK_SERVE` set on build mode", async () =>

it("should have `process.env.WEBPACK_SERVE` set on serve mode", async () => {
await runWatch(__dirname, ["serve"], { killString: /rspack compiled/i });
// wait 1s to make sure the assets have been generated
await new Promise(resolve => setTimeout(resolve, 1000));
const mainJs = await readFile(resolve(__dirname, "dist/main.js"), "utf-8");

expect(mainJs).toContain("WEBPACK_SERVE=true");
Expand Down
3 changes: 1 addition & 2 deletions packages/rspack-cli/tests/build/issue-6359/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require("path");
const { WEBPACK_SERVE } = process.env;
module.exports = /** @type {import('@rspack/cli').Configuration} */ {
mode: "production",
entry: "./entry.js",
Expand All @@ -12,7 +11,7 @@ module.exports = /** @type {import('@rspack/cli').Configuration} */ {
apply(compiler) {
new compiler.webpack.DefinePlugin({
DEFINE_ME: JSON.stringify(
`WEBPACK_SERVE=${WEBPACK_SERVE ?? "<EMPTY>"}`
`WEBPACK_SERVE=${process.env.WEBPACK_SERVE ?? "<EMPTY>"}`
)
}).apply(compiler);
}
Expand Down

2 comments on commit bed0b18

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-09-30 b2ee5d1) Current Change
10000_development-mode + exec 2.18 s ± 33 ms 2.2 s ± 29 ms +0.93 %
10000_development-mode_hmr + exec 685 ms ± 11 ms 681 ms ± 15 ms -0.59 %
10000_production-mode + exec 2.77 s ± 64 ms 2.75 s ± 28 ms -0.81 %
arco-pro_development-mode + exec 1.83 s ± 85 ms 1.85 s ± 70 ms +0.94 %
arco-pro_development-mode_hmr + exec 435 ms ± 3.5 ms 435 ms ± 5 ms +0.05 %
arco-pro_production-mode + exec 3.15 s ± 105 ms 3.16 s ± 75 ms +0.28 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.2 s ± 85 ms 3.19 s ± 55 ms -0.38 %
threejs_development-mode_10x + exec 1.67 s ± 16 ms 1.67 s ± 15 ms +0.33 %
threejs_development-mode_10x_hmr + exec 782 ms ± 13 ms 781 ms ± 9.9 ms -0.19 %
threejs_production-mode_10x + exec 5.07 s ± 26 ms 5.08 s ± 47 ms +0.24 %

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ✅ success
_selftest ✅ success
rspress ✅ success
rslib ✅ success
rsbuild ✅ success
examples ✅ success
devserver ✅ success

Please sign in to comment.