webdriverio/__mocks__/jasmine.ts
Christian Bromann 6464dc7d4a
fix(@wdio/jasmine-framework): become independant from expect-webdriverio (#14592)
* 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
2025-07-08 12:51:42 -07:00

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
}
}