File tree Expand file tree Collapse file tree 6 files changed +28
-5
lines changed Expand file tree Collapse file tree 6 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ async function nodeExecutor(
70
70
executionRecorder . startTestFunction ( `${ instrumentResult . baseName } - init` ) ;
71
71
wasi . start ( ins ) ;
72
72
} catch ( error ) {
73
- exceptionHandler ( error ) ;
73
+ await exceptionHandler ( error ) ;
74
74
}
75
75
executionRecorder . finishTestFunction ( ) ;
76
76
@@ -87,7 +87,7 @@ async function nodeExecutor(
87
87
try {
88
88
( execTestFunction as ( a : number ) => void ) ( functionIndex ) ;
89
89
} catch ( error ) {
90
- exceptionHandler ( error ) ;
90
+ await exceptionHandler ( error ) ;
91
91
}
92
92
executionRecorder . finishTestFunction ( ) ;
93
93
mockInstrumentFunc [ "mockFunctionStatus.clear" ] ( ) ;
Original file line number Diff line number Diff line change
1
+ import chalk from "chalk" ;
1
2
import {
2
3
UnitTestFramework ,
3
4
ImportsArgument ,
@@ -80,7 +81,7 @@ export class ExecutionRecorder implements UnitTestFramework {
80
81
}
81
82
82
83
notifyTestCrash ( error : ExecutionError ) : void {
83
- this . logRecorder . addLog ( `Reason: ${ error . message } ` ) ;
84
+ this . logRecorder . addLog ( `Reason: ${ chalk . red ( error . message ) } ` ) ;
84
85
this . logRecorder . addLog (
85
86
error . stacks
86
87
. map ( ( stack ) => ` at ${ stack . functionName } (${ stack . fileName } :${ stack . lineNumber } :${ stack . columnNumber } )` )
Original file line number Diff line number Diff line change @@ -99,11 +99,15 @@ export class ExecutionResultSummary {
99
99
log ( " " + chalk . yellow ( assertMessage ) ) ;
100
100
}
101
101
if ( hasCrash ) {
102
- log ( " " + chalk . red ( "Test case crashed !" ) ) ;
102
+ log ( " " + chalk . red ( "Test Crashed !" ) ) ;
103
103
}
104
104
for ( const logMessage of logMessages ?? [ ] ) {
105
105
log ( chalk . gray ( logMessage ) ) ;
106
106
}
107
+ if ( logMessages . length > 0 ) {
108
+ // empty line to separate test
109
+ log ( "" ) ;
110
+ }
107
111
}
108
112
}
109
113
}
Original file line number Diff line number Diff line change 1
1
import { test , expect } from "../../../assembly" ;
2
2
import { log } from "./env" ;
3
3
4
- test ( "assertOnTest " , ( ) => {
4
+ test ( "assert on test " , ( ) => {
5
5
log ( "This test will fail due to an assertion error" ) ;
6
6
assert ( false , "This assertion is expected to fail" ) ;
7
7
} ) ;
Original file line number Diff line number Diff line change 1
1
code analysis: OK
2
2
compile testcases: OK
3
3
instrument: OK
4
+ execute testcases: OK
5
+
6
+ test case: 0/2 (success/total)
7
+
8
+ Error Message:
9
+ tests/e2e/assertFailed/tmp/assertOnInit.test - init:
10
+ Test Crashed!
11
+ Reason: unreachable
12
+ at start:tests/e2e/assertFailed/assertOnInit.test (tests/e2e/assertFailed/assertOnInit.test.ts:1:0)
13
+ at ~start (tests/e2e/assertFailed/tmp/assertOnInit.test.instrumented.wasm:1:244)
14
+
15
+ assert on test:
16
+ Test Crashed!
17
+ This test will fail due to an assertion error
18
+ Reason: unreachable
19
+ at start:tests/e2e/assertFailed/assertOnTest.test~anonymous|0 (tests/e2e/assertFailed/assertOnTest.test.ts:6:2)
20
+ at executeTestFunction (tests/e2e/assertFailed/tmp/assertOnTest.test.instrumented.wasm:1:675)
4
21
Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ Error Message:
9
9
failed test:
10
10
tests/e2e/printLogInFailedInfo/source.test.ts:6:2 value: 2 expect: = 3
11
11
This is a log message for the failed test.
12
+
You can’t perform that action at this time.
0 commit comments