@@ -9,15 +9,16 @@ describe('kernel', () => {
99 const cmds = [ cmd , cmd , cmd ]
1010 const reRunner = buildExeRun ( )
1111 const failedCmds = await reRunner ( cmds )
12- expect ( failedCmds . length ) . to . eq ( 3 )
12+ expect ( failedCmds . failedByAssert . length ) . to . eq ( 3 )
1313 }
1414 // all positive
1515 {
1616 const cmd = `node -e "console.log('test')"`
1717 const cmds = [ cmd , cmd , cmd ]
1818 const reRunner = buildExeRun ( )
1919 const failedCmds = await reRunner ( cmds )
20- expect ( failedCmds . length ) . to . eq ( 0 )
20+ expect ( failedCmds . failedByAssert . length ) . to . eq ( 0 )
21+ expect ( failedCmds . failedCommands . length ) . to . eq ( 0 )
2122 }
2223 } )
2324 it ( 'buildExeRun currentExecutionVariable' , async ( ) => {
@@ -27,8 +28,8 @@ describe('kernel', () => {
2728 const cmds = [ cmd ]
2829 const reRunner = buildExeRun ( { currentExecutionVariable : 'CURRENT_EXECUTION_COUNT' } )
2930 const failedCmds = await reRunner ( cmds )
30- expect ( failedCmds . length ) . to . eq ( 1 )
31- expect ( failedCmds . every ( ( failedCmd ) => failedCmd . includes ( 'CURRENT_EXECUTION_COUNT=0' ) ) ) . to . eq ( true )
31+ expect ( failedCmds . failedByAssert . length ) . to . eq ( 1 )
32+ expect ( failedCmds . failedCommands . every ( ( failedCmd ) => failedCmd . includes ( 'CURRENT_EXECUTION_COUNT=0' ) ) ) . to . eq ( true )
3233 }
3334 // + stackAnalize
3435 {
@@ -42,8 +43,8 @@ describe('kernel', () => {
4243 currentExecutionVariable : 'CURRENT_EXECUTION_COUNT'
4344 } )
4445 const failedCmds = await reRunner ( cmds )
45- expect ( failedCmds . length ) . to . eq ( 1 )
46- expect ( failedCmds . every ( ( failedCmd ) => failedCmd . includes ( `CURRENT_EXECUTION_COUNT=${ specRerunCount - 1 } ` ) ) ) . to . eq ( true )
46+ expect ( failedCmds . failedCommands . length ) . to . eq ( 1 )
47+ expect ( failedCmds . failedCommands . every ( ( failedCmd ) => failedCmd . includes ( `CURRENT_EXECUTION_COUNT=${ specRerunCount - 1 } ` ) ) ) . to . eq ( true )
4748 }
4849 } )
4950 it ( 'formCommanWithOption' , async ( ) => {
@@ -64,7 +65,37 @@ describe('kernel', () => {
6465 specRerunCount
6566 } )
6667 const failedCmds = await reRunner ( cmds )
67- expect ( failedCmds ) . to . eql ( [ `${ cmd } ` ] )
68+ expect ( failedCmds . failedByAssert ) . to . eql ( [ ] )
69+ expect ( failedCmds . failedCommands ) . to . eql ( [ `${ cmd } ` ] )
6870 expect ( holder ) . to . eq ( true )
6971 } )
72+
73+ it ( 'failedByAssert' , async ( ) => {
74+ {
75+ const cmd = `node -e "console.log('test'); process.exit(1)"`
76+ const cmds = [ cmd , cmd , cmd ]
77+ const reRunner = buildExeRun ( )
78+ const result = await reRunner ( cmds )
79+ expect ( result . failedByAssert . length ) . to . eq ( 3 )
80+ expect ( result . failedCommands . length ) . to . eq ( 0 )
81+ }
82+ {
83+ const cmd = `node -e "console.log('test'); process.exit(0)"`
84+ const cmds = [ cmd , cmd , cmd ]
85+ const reRunner = buildExeRun ( )
86+ const result = await reRunner ( cmds )
87+ expect ( result . failedByAssert . length ) . to . eq ( 0 )
88+ expect ( result . failedCommands . length ) . to . eq ( 0 )
89+ }
90+ {
91+ const cmd = `node -e "console.log('test'); process.exit(1)"`
92+ const cmdToRerrun = `node -e "console.log('should be rerruned'); process.exit(1)"`
93+ const cmds = [ cmd , cmd , cmdToRerrun ]
94+ const stackAnalize = ( stack ) => stack . includes ( 'should be rerruned' )
95+ const reRunner = buildExeRun ( { stackAnalize} )
96+ const result = await reRunner ( cmds )
97+ expect ( result . failedByAssert . length ) . to . eq ( 2 )
98+ expect ( result . failedCommands . length ) . to . eq ( 1 )
99+ }
100+ } )
70101} )
0 commit comments