beforeEach(async () => { const sandbox = sinon.sandbox.create() ... }) test('/add', () => { // how can I use sandbox here? })
Мне нужно что-то вроде t.context в ava
t.context
Просто объявите песочницу, чтобы она была доступна в объеме beforeEach, и протестируйте:
let sandbox; beforeEach(async () => { sandbox = sinon.sandbox.create() ... }) test('/add', () => { // sandbox available for use })