mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: fix tests when repo checkout was not playwright (#15994)
This commit is contained in:
parent
6009804e0e
commit
f663e5d6cc
@ -42,9 +42,6 @@ async function load(moduleUrl: string, context: { format?: string }, defaultLoad
|
|||||||
if (!moduleUrl.startsWith('file://'))
|
if (!moduleUrl.startsWith('file://'))
|
||||||
return defaultLoad(moduleUrl, context, defaultLoad);
|
return defaultLoad(moduleUrl, context, defaultLoad);
|
||||||
|
|
||||||
if (!moduleUrl.startsWith('file://'))
|
|
||||||
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
||||||
|
|
||||||
const filename = url.fileURLToPath(moduleUrl);
|
const filename = url.fileURLToPath(moduleUrl);
|
||||||
// Bail for node_modules.
|
// Bail for node_modules.
|
||||||
if (belongsToNodeModules(filename))
|
if (belongsToNodeModules(filename))
|
||||||
|
@ -245,12 +245,16 @@ export function wrapFunctionWithLocation<A extends any[], R>(func: (location: Lo
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This will catch the playwright-test package as well
|
||||||
|
const kPlaywrightInternalPrefix = path.resolve(__dirname, '../../playwright');
|
||||||
|
const kPlaywrightCoveragePrefix = path.resolve(__dirname, '../../../tests/config/coverage.js');
|
||||||
|
|
||||||
export function belongsToNodeModules(file: string) {
|
export function belongsToNodeModules(file: string) {
|
||||||
if (file.includes(`${path.sep}node_modules${path.sep}`))
|
if (file.includes(`${path.sep}node_modules${path.sep}`))
|
||||||
return true;
|
return true;
|
||||||
if (file.includes(`${path.sep}playwright${path.sep}packages${path.sep}playwright`))
|
if (file.startsWith(kPlaywrightInternalPrefix))
|
||||||
return true;
|
return true;
|
||||||
if (file.includes(`${path.sep}playwright${path.sep}tests${path.sep}config${path.sep}coverage.js`))
|
if (file.startsWith(kPlaywrightCoveragePrefix))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user