Skip to content

Commit

Permalink
Merge pull request #13132 from webpack/test/stability
Browse files Browse the repository at this point in the history
improve test stability
  • Loading branch information
sokra committed Apr 14, 2021
2 parents de2e499 + ad4b806 commit 31353e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/watchCases/cache/add-defines/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { DefinePlugin } = require("../../../../");
const currentWatchStep = require("../../../helpers/currentWatchStep");

/** @type {import("../../../../").Configuration} */
module.exports = {
Expand All @@ -9,7 +10,7 @@ module.exports = {
compiler => {
const base = {
DEFINE: "{}",
RUN: DefinePlugin.runtimeValue(() => 3 - defines.length, [])
RUN: DefinePlugin.runtimeValue(() => +(currentWatchStep.step || 0), [])
};
const defines = [
{
Expand Down Expand Up @@ -38,7 +39,7 @@ module.exports = {
}
];
compiler.hooks.compilation.tap("webpack.config", (...args) => {
const plugin = new DefinePlugin(defines.shift());
const plugin = new DefinePlugin(defines[+(currentWatchStep.step || 0)]);
plugin.apply(
/** @type {any} */ ({
hooks: {
Expand Down

0 comments on commit 31353e3

Please sign in to comment.