This repository was archived by the owner on Sep 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Original file line number Diff line number Diff line change 11import { spawn , spawnSync , SpawnSyncOptions } from 'child_process'
22import { readConfig } from '../utils'
3- import { checkBrowsers } from './utils'
3+ import { checkBrowsers , getResultByStatus } from './utils'
44import { PARALLEL , BrowserType } from '../constants'
55
66const getSpawnOptions = ( browser : BrowserType ) : SpawnSyncOptions => ( {
@@ -21,12 +21,19 @@ const exec = ({
2121 browser : BrowserType
2222 params : string [ ]
2323} ) : void => {
24- // TODO Add messages for browser process
2524 const options = getSpawnOptions ( browser )
2625 if ( sequence === PARALLEL ) {
27- spawn ( 'node' , [ `node_modules/.bin/jest ${ params } ` ] , options )
26+ const process = spawn ( 'node' , [ `node_modules/.bin/jest ${ params } ` ] , options )
27+ process . on ( 'close' , status => {
28+ console . log ( `${ getResultByStatus ( status ) } tests for ${ browser } \n\n` )
29+ } )
2830 } else {
29- spawnSync ( 'node' , [ `node_modules/.bin/jest ${ params } ` ] , options )
31+ const { status } = spawnSync (
32+ 'node' ,
33+ [ `node_modules/.bin/jest ${ params } ` ] ,
34+ options ,
35+ )
36+ console . log ( `${ getResultByStatus ( status ) } tests for ${ browser } ` )
3037 }
3138}
3239
Original file line number Diff line number Diff line change 1- import { checkBrowsers } from './utils'
1+ import { checkBrowsers , getResultByStatus } from './utils'
22import { BrowserType } from '../constants'
33
44describe ( 'checkBrowsers' , ( ) => {
@@ -18,3 +18,17 @@ describe('checkBrowsers', () => {
1818 ) . toThrow ( )
1919 } )
2020} )
21+
22+ describe ( 'getResultByStatus' , ( ) => {
23+ it ( 'should return "Failed" if passed null' , ( ) => {
24+ expect ( getResultByStatus ( null ) ) . toBe ( 'Failed' )
25+ } )
26+
27+ it ( 'should return "Failed" if passed code 1' , ( ) => {
28+ expect ( getResultByStatus ( 1 ) ) . toBe ( 'Failed' )
29+ } )
30+
31+ it ( 'should return "Passed" if passed code 0' , ( ) => {
32+ expect ( getResultByStatus ( 0 ) ) . toBe ( 'Passed' )
33+ } )
34+ } )
Original file line number Diff line number Diff line change @@ -9,3 +9,7 @@ export const checkBrowsers = (browsers?: BrowserType[]): void => {
99 }
1010 browsers . forEach ( checkBrowserEnv )
1111}
12+
13+ export const getResultByStatus = ( status : number | null ) : string => {
14+ return status !== 0 ? 'Failed' : 'Passed'
15+ }
Original file line number Diff line number Diff line change 88 "forceConsistentCasingInFileNames" : true
99 },
1010 "files" : [
11- " types/global.d.ts" ,
11+ " types/global.d.ts"
1212 ],
1313 "include" : [
14- " src/**/*" ,
14+ " src/**/*"
1515 ],
16- }
16+ "exclude" : [
17+ " node_modules" ,
18+ " **/*.test.ts"
19+ ]
20+ }
You can’t perform that action at this time.
0 commit comments