You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
Hello, I've been through #712 and #727, but I can't fix my testing issue. It seems similar, except I'm using a default export. I have tried to stub but I can't find a way that works. Test repo here
yarn and yarn test, it will fail. comment out the import statement in main.js and it will pass...??? I'm testing main w/o an argument, so it isn't even using the import, just having the import statement causes a fail. How to fix?
main.js
importdoSomethingfrom'./doSomething';// comment out to pass, uncomment out to failexportdefaultasyncfunctionmain(arg){try{if(!arg){thrownewError('An arg is needed.');}console.log(awaitdoSomething(arg));}catch(err){console.log(err.message);}}
control.test.js
import test from 'ava';
import sinon from 'sinon';
import main from './main';
function setupSpy() {
sinon.spy(console, 'log');
}
function tearDownSpy() {
console.log.restore();
}
test('test main - no arg - log error msg', async t => {
setupSpy();
// let stub = sinon.stub(main);
// await stub();
await main();
t.true(console.log.callCount == 1);
tearDownSpy();
// stub.restore();
});
The text was updated successfully, but these errors were encountered:
Hello, I've been through #712 and #727, but I can't fix my testing issue. It seems similar, except I'm using a
default export
. I have tried to stub but I can't find a way that works. Test repo hereyarn
andyarn test
, it will fail. comment out theimport
statement inmain.js
and it will pass...??? I'm testingmain
w/o an argument, so it isn't even using the import, just having theimport
statement causes a fail. How to fix?main.js
control.test.js
The text was updated successfully, but these errors were encountered: