如何从玩笑测试中返回值?
describe('Return 2 from test1', () => {
const x = test('test1', async () => {
return 2;
});
test('test2', async () => {
expect(x).toBe(2);
});
});
我希望x为2
实际结果是:
{ id: 'spec3',
description: 'test1',
fullName: 'Return 2 from test1 test1',
failedExpectations: [],
passedExpectations: [],
pendingReason: '',
testPath: 'agents.test.ts',
status: 'failed' },
currentRun:
{ cancel: [Function: bound cancel],
catch: [Function: bound catch],
then: [Function: bound then] }
}