* fix(@wdio/jasmine-framework): become independant from expect-webdriverio * remove console.log * get tests to work * fix(ci): add eslint as dep * fix tests * run unit tests on Node.js 20, 22 and 24 * move @sveltejs/vite-plugin-svelte to browser runner * remove usage of Node.js primitives in webdriver and webdriverio * fix unit tests * skip svelte test for now * increase timeouts * fix component test * increase timeouts * increase timeouts * increase timeouts * fix imageSize call
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import { vi } from 'vitest'
|
|
|
|
export const beforeAllHook = vi.fn()
|
|
export const executeHook = vi.fn()
|
|
export const jasmine = {
|
|
addReporter: vi.fn(),
|
|
specFilter: vi.fn(),
|
|
configure: vi.fn(),
|
|
getEnv: vi.fn().mockImplementation(() => jasmine),
|
|
Spec: {
|
|
prototype: {
|
|
addExpectationResult: vi.fn(),
|
|
execute: executeHook
|
|
}
|
|
},
|
|
Suite: {
|
|
prototype: {
|
|
beforeAll: beforeAllHook
|
|
}
|
|
},
|
|
matchers: {
|
|
toBe: vi.fn().mockReturnValue({
|
|
compare: vi.fn(),
|
|
negativeCompare: vi.fn()
|
|
})
|
|
},
|
|
addMatchers: vi.fn(),
|
|
addAsyncMatchers: vi.fn(),
|
|
beforeAll: vi.fn((cb) => cb()),
|
|
expectAsync: {
|
|
any: vi.fn(),
|
|
anything: vi.fn(),
|
|
arrayContaining: vi.fn(),
|
|
objectContaining: vi.fn(),
|
|
stringContaining: vi.fn(),
|
|
stringMatching: vi.fn(),
|
|
not: vi.fn()
|
|
}
|
|
}
|
|
export default class JasmineMock {
|
|
args: unknown[]
|
|
beforeAllHook = beforeAllHook
|
|
executeHook = executeHook
|
|
jasmine = jasmine
|
|
env = {
|
|
beforeAll: vi.fn(),
|
|
beforeEach: vi.fn(),
|
|
afterEach: vi.fn(),
|
|
afterAll: vi.fn()
|
|
}
|
|
|
|
addSpecFile = vi.fn()
|
|
onComplete = vi.fn().mockImplementation((cb) => setTimeout(cb, 10))
|
|
randomizeTests = vi.fn()
|
|
execute = vi.fn()
|
|
|
|
constructor (...args: unknown[]) {
|
|
this.args = args
|
|
}
|
|
}
|