This repository was archived by the owner on Aug 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import * as path from 'path'
5
5
import { CLIError , config , ExitError } from '../src'
6
6
import { handle } from '../src/handle'
7
7
8
- const wait = ( ms : number ) => new Promise ( resolve => setTimeout ( ( ) => resolve ( ) , ms ) . unref ( ) )
9
8
const errlog = path . join ( __dirname , '../tmp/mytest/error.log' )
10
9
11
10
describe ( 'handle' , ( ) => {
@@ -56,7 +55,7 @@ describe('handle', () => {
56
55
handle ( new CLIError ( 'uh oh!' ) )
57
56
expect ( ctx . stderr ) . to . equal ( ' ✖ Error: uh oh!\n' )
58
57
expect ( process . exitCode ) . to . equal ( 2 )
59
- await wait ( 10 )
58
+ await config . errorLogger ! . flush ( )
60
59
expect ( fs . readFileSync ( errlog , 'utf8' ) ) . to . contain ( 'Error: uh oh!' )
61
60
} )
62
61
} )
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import * as path from 'path'
4
4
5
5
import { config , warn } from '../src'
6
6
7
- const wait = ( ms : number ) => new Promise ( resolve => setTimeout ( ( ) => resolve ( ) , ms ) . unref ( ) )
8
7
const errlog = path . join ( __dirname , '../tmp/mytest/warn.log' )
9
8
10
9
describe ( 'warn' , ( ) => {
@@ -14,9 +13,9 @@ describe('warn', () => {
14
13
. finally ( ( ) => config . errlog = undefined )
15
14
. it ( 'warns' , async ctx => {
16
15
warn ( 'foo!' )
17
- await wait ( 51 )
18
16
expect ( ctx . stderr ) . to . contain ( 'Warning: foo!' )
19
17
expect ( process . exitCode ) . to . be . undefined
18
+ await config . errorLogger ! . flush ( )
20
19
expect ( fs . readFileSync ( errlog , 'utf8' ) ) . to . contain ( 'Warning: foo!' )
21
20
} )
22
21
} )
You can’t perform that action at this time.
0 commit comments