mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
Some checks are pending
* test(web-shell): add browser and lint harness * test(web-shell): harden browser smoke harness * fix(web-shell): guard mock daemon model state * test(web-shell): remove unused scenario harness * fix(web-shell): remove stale lint disables * test(web-shell): make matchMedia stub writable * fix(web-shell): exclude tests from package typecheck * test(web-shell): tighten mock daemon route contract * Update packages/web-shell/client/e2e/utils/mockDaemon.ts Co-authored-by: qwen-code-ci-bot <qwen-code-ci@service.alibaba.com> * test(web-shell): clear stale SSE connections * ci(web-shell): gate smoke on full CI profile --------- Co-authored-by: ermin.zem <ermin.zem@alibaba-inc.com> Co-authored-by: qwen-code-ci-bot <qwen-code-ci@service.alibaba.com> Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com> Co-authored-by: 易良 <1204183885@qq.com>
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
import { vi } from 'vitest';
|
|
|
|
(
|
|
globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }
|
|
).IS_REACT_ACT_ENVIRONMENT = true;
|
|
|
|
const globalWithDom = globalThis as typeof globalThis & {
|
|
Element?: typeof Element;
|
|
ResizeObserver?: typeof ResizeObserver;
|
|
};
|
|
|
|
if (typeof globalWithDom.ResizeObserver === 'undefined') {
|
|
globalWithDom.ResizeObserver = class ResizeObserverStub {
|
|
observe() {}
|
|
unobserve() {}
|
|
disconnect() {}
|
|
} as typeof ResizeObserver;
|
|
}
|
|
|
|
if (
|
|
typeof globalWithDom.Element !== 'undefined' &&
|
|
!globalWithDom.Element.prototype.scrollIntoView
|
|
) {
|
|
globalWithDom.Element.prototype.scrollIntoView = () => {};
|
|
}
|
|
|
|
if (typeof navigator !== 'undefined' && !navigator.clipboard) {
|
|
Object.defineProperty(navigator, 'clipboard', {
|
|
configurable: true,
|
|
value: {
|
|
writeText: vi.fn(() => Promise.resolve()),
|
|
},
|
|
});
|
|
}
|
|
|
|
if (typeof window !== 'undefined' && !window.matchMedia) {
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
configurable: true,
|
|
writable: true,
|
|
value: vi.fn((query: string) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(),
|
|
removeListener: vi.fn(),
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
})),
|
|
});
|
|
}
|
|
|
|
if (typeof navigator !== 'undefined' && !navigator.mediaDevices) {
|
|
Object.defineProperty(navigator, 'mediaDevices', {
|
|
configurable: true,
|
|
value: {
|
|
getUserMedia: vi.fn(() =>
|
|
Promise.reject(new Error('getUserMedia is not mocked for this test')),
|
|
),
|
|
},
|
|
});
|
|
}
|