Skip to content

Commit

Permalink
Add debug test with throwing loader in lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Tschui committed May 9, 2019
1 parent a22531b commit 0431636
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions debug/test/browser/debug.test.js
Expand Up @@ -487,6 +487,27 @@ describe('debug', () => {
expect(console.warn).to.be.calledOnce;
});
});

it('should not log a component if lazy\'s loader throws', () => {
const FakeLazy = lazy(() => { throw new Error('Hello'); });
FakeLazy.propTypes = {};
let error;
try {
render(
<Suspense fallback={<div>fallback...</div>} >
<FakeLazy />
</Suspense>,
scratch
);
}
catch (e) {
error = e;
}

expect(console.warn).to.be.calledOnce;
expect(error).not.to.be.undefined;
expect(error.message).to.eql('Hello');
});
});
});
});

0 comments on commit 0431636

Please sign in to comment.