2021-10-28 19:32:31 +00:00
|
|
|
const getCoreTestsRoot = () => {
|
|
|
|
// Figure out where we're installed.
|
|
|
|
// Typically will be in node_modules/, but WooCommerce
|
|
|
|
// uses a local file path (packages/js/e2e-core-tests).
|
|
|
|
let coreTestsPath = false;
|
2022-07-27 20:13:17 +00:00
|
|
|
const dirPath = __dirname;
|
2021-10-28 19:32:31 +00:00
|
|
|
|
2022-07-27 20:13:17 +00:00
|
|
|
if ( dirPath.indexOf( 'node_modules' ) > -1 ) {
|
|
|
|
coreTestsPath = dirPath.split( 'node_modules' )[ 0 ];
|
|
|
|
} else if ( dirPath.indexOf( 'packages/js/e2e-core-tests' ) > -1 ) {
|
|
|
|
coreTestsPath = dirPath.split( 'packages/js/e2e-core-tests' )[ 0 ];
|
2021-10-28 19:32:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
appRoot: coreTestsPath,
|
2022-07-27 20:13:17 +00:00
|
|
|
coreTestsRoot: __dirname,
|
2021-10-28 19:32:31 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = getCoreTestsRoot;
|