Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(builder): fix progress log e2e test #4678

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/e2e/builder/cases/progress/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { logger } from '@modern-js/utils';
webpackOnlyTest('should emit progress log in non-TTY environment', async () => {
process.stdout.isTTY = false;

const { info, success } = logger;
const { info, ready } = logger;
const infoMsgs: any[] = [];
const successMsgs: any[] = [];
const readyMsgs: any[] = [];

logger.info = message => {
infoMsgs.push(message);
};
logger.success = message => {
successMsgs.push(message);
logger.ready = message => {
readyMsgs.push(message);
};

await build({
Expand All @@ -29,13 +29,13 @@ webpackOnlyTest('should emit progress log in non-TTY environment', async () => {
});

expect(
infoMsgs.some(message => message.includes('[Client] compile progress')),
infoMsgs.some(message => message.includes('Client compile progress')),
).toBeTruthy();
expect(
successMsgs.some(message => message.includes('[Client] compile succeed')),
readyMsgs.some(message => message.includes('Client compiled')),
).toBeTruthy();

process.stdout.isTTY = true;
logger.info = info;
logger.success = success;
logger.ready = ready;
});