Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 95 additions & 5 deletions src/config/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BrowserConfig } from "./browser-config";
import type { BrowserTestRunEnvOptions } from "../runner/browser-env/vite/types";
import type { Test } from "../types";
import type { Suite, Test } from "../types";
import type { ChildProcessWithoutNullStreams } from "child_process";
import { RequestOptions } from "https";

Expand Down Expand Up @@ -128,8 +128,94 @@ export interface ExpectOptsConfig {
interval: number;
}

export interface MochaOpts extends Omit<Mocha.MochaOptions, "ui"> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Mocha.MochaOptions in order to not get conflicts in it, describe etc. Reproduced when service has @types/mocha module (can be installed as dependencies from some other module).

ui?: string | ((suite: Mocha.Suite) => void);
// copied from Mocha.MochaOptions (cannot be used directly so that there are no conflicts in global variables)
export interface MochaOpts {
/** Propagate uncaught errors? */
allowUncaught?: boolean;

/** Force `done` callback or promise? */
asyncOnly?: boolean;

/** bail on the first test failure. */
bail?: boolean;

/** Check for global variable leaks? */
checkLeaks?: boolean;

/** Color TTY output from reporter */
color?: boolean;

/** Delay root suite execution? */
delay?: boolean;

/** Show diff on failure? */
diff?: boolean;

/** Report tests without running them? */
dryRun?: boolean;

/** Test filter given string. */
fgrep?: string;

/** Tests marked `only` fail the suite? */
forbidOnly?: boolean;

/** Pending tests fail the suite? */
forbidPending?: boolean;

/** Full stacktrace upon failure? */
fullTrace?: boolean;

/** Variables expected in global scope. */
globals?: string[];

/** Test filter given regular expression. */
grep?: string | RegExp;

/** Enable desktop notifications? */
growl?: boolean;

/** Display inline diffs? */
inlineDiffs?: boolean;

/** Invert test filter matches? */
invert?: boolean;

/** Disable syntax highlighting? */
noHighlighting?: boolean;

/** Reporter name or constructor. */
reporter?: string;

/** Reporter settings object. */
reporterOptions?: unknown;

/** Number of times to retry failed tests. */
retries?: number;

/** Slow threshold value. */
slow?: number;

/** Timeout threshold value. */
timeout?: number | string;

/** Run jobs in parallel */
parallel?: boolean;

/** Max number of worker processes for parallel runs. */
jobs?: number;

/** Hooks to bootstrap the root suite with. */
rootHooks?: unknown;

/** Pathname of `rootHooks` plugin for parallel runs. */
require?: string[];

/** Should be `true` if `Mocha` process is running in a worker process. */
isWorker?: boolean;

/** Interface name or path to file with custom interface implementation. */
ui?: string | Suite;
}

export interface SystemConfig {
Expand Down Expand Up @@ -260,9 +346,13 @@ export interface SetsConfigParsed {
browsers: Array<string>;
}

type PartialCommonConfig = Partial<Omit<CommonConfig, "system">> & {
system?: Partial<SystemConfig>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field system should not require specifying all fields

};

// Only browsers desiredCapabilities are required in input config
export type ConfigInput = Partial<CommonConfig> & {
browsers: Record<string, Partial<CommonConfig> & { desiredCapabilities: WebdriverIO.Capabilities }>;
export type ConfigInput = Partial<PartialCommonConfig> & {
browsers: Record<string, PartialCommonConfig & { desiredCapabilities: WebdriverIO.Capabilities }>;
plugins?: Record<string, unknown>;
sets?: Record<string, SetsConfig>;
prepareEnvironment?: () => void | null;
Expand Down
Loading