Skip to content

Commit 3d70902

Browse files
committed
chore: silence expected warnings in tests
1 parent 56f8175 commit 3d70902

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

test/setup.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Silence warnings from showWarning utility during tests. These warnings are expected.
2+
3+
// eslint-disable-next-line no-console
4+
const originalWarn = console.warn;
5+
6+
beforeEach(() => {
7+
globalThis.console.warn = (message: unknown, ...args: unknown[]) => {
8+
if (
9+
typeof message === "string" &&
10+
message.startsWith("CssSelectorGenerator:")
11+
) {
12+
return;
13+
}
14+
originalWarn(message, ...args);
15+
};
16+
});
17+
18+
afterEach(() => {
19+
globalThis.console.warn = originalWarn;
20+
});

web-test-runner.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,13 @@ export default {
1212
timeout: "2000",
1313
},
1414
},
15+
testsStartTimeout: 20000,
16+
testsFinishTimeout: 20000,
17+
testRunnerHtml: (testFramework) =>
18+
`<html>
19+
<head>
20+
<script type="module" src="${testFramework}"></script>
21+
<script type="module" src="/test/setup.ts"></script>
22+
</head>
23+
</html>`,
1524
};

0 commit comments

Comments
 (0)