Skip to content

Commit eadbd7d

Browse files
authored
Merge pull request #16810 from snitin315/fix/progress-length
fix: limit progress bar length to 40 when no columns provided
2 parents f58ff9b + 94f8804 commit eadbd7d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/node/nodeConsole.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ module.exports = ({ colors, appendOnly, stream }) => {
3838

3939
const writeStatusMessage = () => {
4040
if (!currentStatusMessage) return;
41-
const l = stream.columns;
42-
const args = l
43-
? truncateArgs(currentStatusMessage, l - 1)
44-
: currentStatusMessage;
41+
const l = stream.columns || 40;
42+
const args = truncateArgs(currentStatusMessage, l - 1);
4543
const str = args.join(" ");
4644
const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`;
4745
stream.write(`\x1b[2K\r${coloredStr}`);

test/ProgressPlugin.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ describe("ProgressPlugin", function () {
218218
const logs = getLogs(stderr.toString());
219219

220220
expect(logs.length).toBeGreaterThan(20);
221-
expect(_.maxBy(logs, "length").length).toBeGreaterThan(50);
221+
expect(_.maxBy(logs, "length").length).not.toBeGreaterThan(40);
222222
});
223223
});
224224

@@ -242,6 +242,7 @@ describe("ProgressPlugin", function () {
242242
activeModules: true
243243
});
244244

245+
process.stderr.columns = 70;
245246
return RunCompilerAsync(compiler).then(() => {
246247
const logs = stderr.toString();
247248

@@ -255,6 +256,7 @@ describe("ProgressPlugin", function () {
255256
it("should get the custom handler text from the log", () => {
256257
const compiler = createSimpleCompilerWithCustomHandler();
257258

259+
process.stderr.columns = 70;
258260
return RunCompilerAsync(compiler).then(() => {
259261
const logs = stderr.toString();
260262
expect(logs).toEqual(

0 commit comments

Comments
 (0)