File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
import nodeAsyncHooks from "node:async_hooks" ;
2
2
import nodeCrypto from "node:crypto" ;
3
3
import nodePerfHooks from "node:perf_hooks" ;
4
+ import nodeEvents from "node:events" ;
4
5
5
6
const nodeCompatTests = {
6
7
globals : {
@@ -26,6 +27,15 @@ const nodeCompatTests = {
26
27
performance : ( ) => nodePerfHooks . performance . now ( ) > 0 ,
27
28
PerformanceObserver : ( ) => new nodePerfHooks . PerformanceObserver ( ( ) => { } ) ,
28
29
} ,
30
+ events : {
31
+ EventEmitter : ( ) => {
32
+ const emitter = new nodeEvents . EventEmitter ( ) ;
33
+ return new Promise < boolean > ( ( resolve ) => {
34
+ emitter . on ( "test" , ( ) => resolve ( true ) ) ;
35
+ emitter . emit ( "test" ) ;
36
+ } ) ;
37
+ } ,
38
+ } ,
29
39
async_hooks : {
30
40
AsyncLocalStorage : async ( ) => {
31
41
const ctx = new nodeAsyncHooks . AsyncLocalStorage ( ) ;
@@ -96,7 +106,8 @@ export default eventHandler(async (event) => {
96
106
async function testFn ( fn : ( ) => any ) {
97
107
try {
98
108
return ! ! ( await fn ( ) ) ;
99
- } catch {
109
+ } catch ( error ) {
110
+ console . error ( error ) ;
100
111
return false ;
101
112
}
102
113
}
You can’t perform that action at this time.
0 commit comments