Skip to content

Commit 723a8ee

Browse files
committed
test: clearly define window type to avoid type errors and 'any' usage
1 parent 39c10ad commit 723a8ee

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/browser-logs/test/serialize-deserialize.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ const require = createRequire(import.meta.url);
1414
const serializeScript = fs.readFileSync(require.resolve('../dist/serialize.js'), 'utf-8');
1515
const defaultOptions = { browserRootDir: import.meta.dirname, cwd: import.meta.dirname };
1616

17+
declare global {
18+
interface Window {
19+
_serialize: (value: unknown) => string;
20+
}
21+
}
22+
1723
describe('serialize deserialize', { timeout: 10000 }, function () {
1824
let browser: Browser;
1925
let page: Page;
@@ -30,8 +36,6 @@ describe('serialize deserialize', { timeout: 10000 }, function () {
3036
await browser.close();
3137
});
3238

33-
// window['_serialize'] avoids TS `as any` cast -- strip-types replaces casts with whitespace,
34-
// which shifts column numbers in Chrome-evaluated code and breaks error stack trace assertions.
3539
it('handles strings', async () => {
3640
const serialized = await page.evaluate(() => window['_serialize']('foo'));
3741
const deserialized = await deserialize(serialized);

0 commit comments

Comments
 (0)