返回 CodeWhale
index.mjs
1 export const inject = ['tools']
2 export function apply(ctx) {
3 ctx.tools.register({ name: 'hang_probe', description: 'Block the fixture event loop.',
4 parameters: { type: 'object', properties: { ms: { type: 'number' } } },
5 execute(args) {
6 const end = args.ms === undefined ? Infinity : Date.now() + args.ms
7 while (Date.now() < end) {}
8 return { resumed: true }
9 },
10 })
11 }
12
12 lines Plain Text