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 1
1
import { spawn , spawnSync , SpawnSyncOptions } from 'child_process'
2
2
import { readConfig } from '../utils'
3
- import { checkBrowsers } from './utils'
3
+ import { checkBrowsers , getResultByStatus } from './utils'
4
4
import { PARALLEL , BrowserType } from '../constants'
5
5
6
6
const getSpawnOptions = ( browser : BrowserType ) : SpawnSyncOptions => ( {
@@ -21,12 +21,19 @@ const exec = ({
21
21
browser : BrowserType
22
22
params : string [ ]
23
23
} ) : void => {
24
- // TODO Add messages for browser process
25
24
const options = getSpawnOptions ( browser )
26
25
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
+ } )
28
30
} 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 } ` )
30
37
}
31
38
}
32
39
Original file line number Diff line number Diff line change 1
- import { checkBrowsers } from './utils'
1
+ import { checkBrowsers , getResultByStatus } from './utils'
2
2
import { BrowserType } from '../constants'
3
3
4
4
describe ( 'checkBrowsers' , ( ) => {
@@ -18,3 +18,17 @@ describe('checkBrowsers', () => {
18
18
) . toThrow ( )
19
19
} )
20
20
} )
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 => {
9
9
}
10
10
browsers . forEach ( checkBrowserEnv )
11
11
}
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 8
8
"forceConsistentCasingInFileNames" : true
9
9
},
10
10
"files" : [
11
- " types/global.d.ts" ,
11
+ " types/global.d.ts"
12
12
],
13
13
"include" : [
14
- " src/**/*" ,
14
+ " src/**/*"
15
15
],
16
- }
16
+ "exclude" : [
17
+ " node_modules" ,
18
+ " **/*.test.ts"
19
+ ]
20
+ }
You can’t perform that action at this time.
0 commit comments