Skip to content

Commit

Permalink
fix: remove cycle dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Mar 6, 2023
1 parent c6d19db commit ed5c9eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 0 additions & 4 deletions packages/expect-puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@
"prebuild": "rm -rf dist",
"build": "rollup -c"
},
"dependencies": {
"jest-environment-puppeteer": "^8.0.0"
},
"devDependencies": {
"jest-puppeteer": "^8.0.0",
"puppeteer": "^19.7.2",
"rollup": "^3.15.0",
"rollup-plugin-dts": "^5.2.0",
Expand Down
16 changes: 14 additions & 2 deletions packages/expect-puppeteer/src/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { FrameWaitForFunctionOptions } from "puppeteer";
import { puppeteerConfig } from "jest-environment-puppeteer/globals";

export type Options = FrameWaitForFunctionOptions;

Expand All @@ -9,9 +8,22 @@ export const setDefaultOptions = (options: Options) => {
defaultOptionsValue = options;
};

const globalWithPuppeteerConfig = global as {
puppeteerConfig?: {
launch?: {
slowMo?: number;
};
connect?: {
slowMo?: number;
};
};
};

export const getDefaultOptions = (): Options => {
const slowMo =
puppeteerConfig?.launch?.slowMo || puppeteerConfig?.connect?.slowMo || 0;
globalWithPuppeteerConfig.puppeteerConfig?.launch?.slowMo ||
globalWithPuppeteerConfig.puppeteerConfig?.connect?.slowMo ||
0;
const defaultTimeout = defaultOptionsValue.timeout || 0;

if (slowMo || defaultOptionsValue.timeout) {
Expand Down

0 comments on commit ed5c9eb

Please sign in to comment.