@@ -422,6 +422,10 @@ describe('core', () => {
422
422
assert . ok ( p . exitCode instanceof Promise )
423
423
assert . ok ( p . signal instanceof AbortSignal )
424
424
assert . equal ( p . output , null )
425
+ assert . equal ( Object . prototype . toString . call ( p ) , '[object ProcessPromise]' )
426
+ assert . equal ( '' + p , '[object ProcessPromise]' )
427
+ assert . equal ( `${ p } ` , '[object ProcessPromise]' )
428
+ assert . equal ( + p , NaN )
425
429
426
430
await p
427
431
assert . ok ( p . output instanceof ProcessOutput )
@@ -907,10 +911,7 @@ describe('core', () => {
907
911
lines . push ( line )
908
912
}
909
913
910
- assert . equal ( lines . length , 3 , 'Should have 3 lines' )
911
- assert . equal ( lines [ 0 ] , 'Line1' , 'First line should be "Line1"' )
912
- assert . equal ( lines [ 1 ] , 'Line2' , 'Second line should be "Line2"' )
913
- assert . equal ( lines [ 2 ] , 'Line3' , 'Third line should be "Line3"' )
914
+ assert . deepEqual ( lines , [ 'Line1' , 'Line2' , 'Line3' ] )
914
915
} )
915
916
916
917
it ( 'should handle partial lines correctly' , async ( ) => {
@@ -920,18 +921,7 @@ describe('core', () => {
920
921
lines . push ( line )
921
922
}
922
923
923
- assert . equal ( lines . length , 3 , 'Should have 3 lines' )
924
- assert . equal (
925
- lines [ 0 ] ,
926
- 'PartialLine1' ,
927
- 'First line should be "PartialLine1"'
928
- )
929
- assert . equal ( lines [ 1 ] , 'Line2' , 'Second line should be "Line2"' )
930
- assert . equal (
931
- lines [ 2 ] ,
932
- 'PartialLine3' ,
933
- 'Third line should be "PartialLine3"'
934
- )
924
+ assert . deepEqual ( lines , [ 'PartialLine1' , 'Line2' , 'PartialLine3' ] )
935
925
} )
936
926
937
927
it ( 'should handle empty stdout' , async ( ) => {
@@ -951,12 +941,7 @@ describe('core', () => {
951
941
lines . push ( line )
952
942
}
953
943
954
- assert . equal (
955
- lines . length ,
956
- 1 ,
957
- 'Should have 1 line for single line without trailing newline'
958
- )
959
- assert . equal ( lines [ 0 ] , 'SingleLine' , 'The line should be "SingleLine"' )
944
+ assert . deepEqual ( lines , [ 'SingleLine' ] )
960
945
} )
961
946
962
947
it ( 'should yield all buffered and new chunks when iterated after a delay' , async ( ) => {
@@ -1118,6 +1103,14 @@ describe('core', () => {
1118
1103
assert . equal ( o . signal , 'SIGTERM' )
1119
1104
assert . equal ( o . exitCode , - 1 )
1120
1105
assert . equal ( o . duration , 20 )
1106
+ assert . equal ( Object . prototype . toString . call ( o ) , '[object ProcessOutput]' )
1107
+ } )
1108
+
1109
+ test ( '[Symbol.toPrimitive]' , ( ) => {
1110
+ const o = new ProcessOutput ( - 1 , 'SIGTERM' , '' , '' , 'foo\n' , 'msg' , 20 )
1111
+ assert . equal ( '' + o , 'foo' )
1112
+ assert . equal ( `${ o } ` , 'foo' )
1113
+ assert . equal ( + o , NaN )
1121
1114
} )
1122
1115
1123
1116
test ( 'toString()' , async ( ) => {
@@ -1175,6 +1168,7 @@ describe('core', () => {
1175
1168
}
1176
1169
assert . deepEqual ( lines , expected )
1177
1170
assert . deepEqual ( o . lines ( ) , expected )
1171
+ assert . deepEqual ( [ ...o ] , expected ) // isConcatSpreadable
1178
1172
} )
1179
1173
1180
1174
describe ( 'static' , ( ) => {
0 commit comments