File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ try {
102102 for ( const input of args . values . reporter ) {
103103 const [ name , dest ] = input . split ( ':' )
104104 const Ctor = reporters [ name ] || await import ( name ) . then ( ( m ) => m . default || m )
105- const reporter = Object . getOwnPropertyDescriptor ( Ctor . prototype , 'constructor' ) ? new Ctor ( ) : Ctor
105+ const reporter = Ctor . prototype && Object . getOwnPropertyDescriptor ( Ctor . prototype , 'constructor' ) ? new Ctor ( ) : Ctor
106106 let output = process . stdout
107107 if ( dest ) {
108108 output = createWriteStream ( dest )
@@ -140,6 +140,7 @@ try {
140140 /* c8 ignore next 3 */
141141} catch ( err ) {
142142 console . error ( err )
143+ process . exitCode = 1
143144} finally {
144145 if ( covDir ) {
145146 try {
Original file line number Diff line number Diff line change @@ -62,16 +62,29 @@ test('disable ts and run no tests', async () => {
6262} )
6363
6464test ( 'reporter from node_modules' , async ( ) => {
65- const cwd = join ( import . meta. url , '..' , 'fixtures' , 'ts-esm2' )
66- await rm ( path . join ( cwd , 'dist' ) , { recursive : true , force : true } )
65+ const cwd = join ( import . meta. url , '..' , 'fixtures' , 'ts-esm' )
6766 const { stdout } = await execa ( 'node' , [
6867 borp ,
6968 '--reporter=spec' ,
70- '--reporter=@reporters/silent' ,
71- '--no-typescript'
69+ '--reporter=@reporters/silent'
7270 ] , {
7371 cwd
7472 } )
7573
76- strictEqual ( stdout . indexOf ( 'tests 0' ) >= 0 , true )
74+ strictEqual ( stdout . indexOf ( 'tests 2' ) >= 0 , true )
75+ } )
76+
77+ test ( 'gh reporter' , async ( ) => {
78+ const cwd = join ( import . meta. url , '..' , 'fixtures' , 'js-esm' )
79+ const { stdout } = await execa ( 'node' , [
80+ borp ,
81+ '--reporter=gh'
82+ ] , {
83+ cwd,
84+ env : {
85+ GITHUB_ACTIONS : '1'
86+ }
87+ } )
88+
89+ strictEqual ( stdout . indexOf ( '::notice' ) >= 0 , true )
7790} )
You can’t perform that action at this time.
0 commit comments