Split jest tests into fast and slow groups (#1401)

This commit is contained in:
Chenlei Hu
2024-11-01 22:39:42 -04:00
committed by GitHub
parent d719a4e0fb
commit 8baaf380dc
22 changed files with 80 additions and 36 deletions

View 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()
}
})
}