expect-webdriverio
Version:
WebdriverIO Assertion Library
26 lines (25 loc) • 855 B
JavaScript
import { expect as expectLib } from 'expect';
import wdioMatchers from './matchers.js';
import { DEFAULT_OPTIONS } from './constants.js';
export const matchers = new Map();
const extend = expectLib.extend;
expectLib.extend = (m) => {
if (!m || typeof m !== 'object') {
return;
}
Object.entries(m).forEach(([name, matcher]) => matchers.set(name, matcher));
return extend(m);
};
expectLib.extend(wdioMatchers);
export const expect = expectLib;
export const getConfig = () => DEFAULT_OPTIONS;
export const setDefaultOptions = (options = {}) => {
Object.entries(options).forEach(([key, value]) => {
if (key in DEFAULT_OPTIONS) {
DEFAULT_OPTIONS[key] = value;
}
});
};
export const setOptions = setDefaultOptions;
export { SnapshotService } from './snapshot.js';
export * as utils from './utils.js';