Skip to content

Not rendering properly with Listr #157

Description

@vajahath

Looks like node-progress not rendering properly with listr.
Consider running this following code where 2 libs coexist:

const ProgressBar = require('progress');
const Listr = require('listr');

// progress-bar
let bar = new ProgressBar(':bar', { total: 10 });
let timer = setInterval(function() {
	bar.tick();
	if (bar.complete) {
		console.log('\ncomplete\n');
		clearInterval(timer);
	}
}, 1000);

// listr
const tasks = new Listr([{
		title: 'task 1',
		task: () => {
			return new Promise((resolve) => {
				setTimeout(() => {
					resolve()
				}, 3000)
			})
		}
	},
	{
		title: 'Task 2',
		task: () => {
			return new Promise((resolve) => {
				setTimeout(() => {
					resolve()
				}, 3000)
			})
		}
	}
]);

tasks.run().catch(err => {
	console.error(err);
});

On the output progress bar blinks periodically..

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions