Skip to content

Commit b408f2b

Browse files
committed
test: fix test
1 parent 1da0367 commit b408f2b

File tree

1 file changed

+8
-4
lines changed
  • packages/@lwc/integration-karma/test/signal/protocol

1 file changed

+8
-4
lines changed

packages/@lwc/integration-karma/test/signal/protocol/index.spec.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ describe('signal protocol', () => {
236236

237237
let caughtError;
238238

239+
// handle errors thrown both with and without native custom element lifecycle
239240
catchUnhandledRejectionsAndErrors((error) => {
240241
caughtError = error;
241242
});
@@ -246,11 +247,14 @@ describe('signal protocol', () => {
246247

247248
it('does throw an error for objects that throw upon "in" checks', async () => {
248249
const elm = createElement('x-throws', { is: Throws });
249-
document.body.appendChild(elm);
250250

251-
// wait 2 ticks for all errors to be caught
252-
await new Promise(setTimeout);
253-
await new Promise(setTimeout);
251+
try {
252+
document.body.appendChild(elm);
253+
} catch (err) {
254+
caughtError = err;
255+
}
256+
257+
await Promise.resolve();
254258

255259
// still renders
256260
expect(elm.shadowRoot.querySelector('h1').textContent).toBe('hello');

0 commit comments

Comments
 (0)