mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +00:00
Split jest tests into fast and slow groups (#1401)
This commit is contained in:
70
tests-ui/tests/globalSetup.ts
Normal file
70
tests-ui/tests/globalSetup.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
// @ts-strict-ignore
|
||||
module.exports = async function () {
|
||||
global.ResizeObserver = class ResizeObserver {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
}
|
||||
|
||||
const { nop } = require('../utils/nopProxy')
|
||||
global.enableWebGLCanvas = nop
|
||||
|
||||
HTMLCanvasElement.prototype.getContext = nop
|
||||
|
||||
localStorage['Comfy.Settings.Comfy.Logging.Enabled'] = 'false'
|
||||
|
||||
jest.mock('@/services/dialogService', () => {
|
||||
return {
|
||||
showLoadWorkflowWarning: jest.fn(),
|
||||
showMissingModelsWarning: jest.fn(),
|
||||
showSettingsDialog: jest.fn(),
|
||||
showExecutionErrorDialog: jest.fn(),
|
||||
showTemplateWorkflowsDialog: jest.fn(),
|
||||
showPromptDialog: jest
|
||||
.fn()
|
||||
.mockImplementation((message, defaultValue) => {
|
||||
return Promise.resolve(defaultValue)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
jest.mock('@/stores/toastStore', () => {
|
||||
return {
|
||||
useToastStore: () => ({
|
||||
addAlert: jest.fn()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
jest.mock('@/stores/extensionStore', () => {
|
||||
return {
|
||||
useExtensionStore: () => ({
|
||||
registerExtension: jest.fn(),
|
||||
loadDisabledExtensionNames: jest.fn()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
jest.mock('@/stores/workspaceStore', () => {
|
||||
return {
|
||||
useWorkspaceStore: () => ({
|
||||
shiftDown: false,
|
||||
spinner: false,
|
||||
focusMode: false,
|
||||
toggleFocusMode: jest.fn()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
jest.mock('@/stores/workspace/bottomPanelStore', () => {
|
||||
return {
|
||||
toggleBottomPanel: jest.fn()
|
||||
}
|
||||
})
|
||||
|
||||
jest.mock('vue-i18n', () => {
|
||||
return {
|
||||
useI18n: jest.fn()
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user