Skip to content

Commit

Permalink
test(builder): fix progress log e2e test (#4678)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Sep 19, 2023
1 parent 85f877b commit dff7960
Showing 1 changed file with 7 additions and 7 deletions.
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;
});

0 comments on commit dff7960

Please sign in to comment.