@public-ui/visual-tests 1.7.0-rc.12 → 1.7.0-rc.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/visual-tests",
3
- "version": "1.7.0-rc.12",
3
+ "version": "1.7.0-rc.13",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": "https://github.com/public-ui/kolibri",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@playwright/test": "1.38.0",
29
- "@public-ui/sample-react": "1.7.0-rc.12",
29
+ "@public-ui/sample-react": "1.7.0-rc.13",
30
30
  "portfinder": "1.0.32",
31
31
  "serve": "14.2.1"
32
32
  },
package/src/index.js CHANGED
@@ -19,9 +19,22 @@ if (!tempDir) {
19
19
  process.env.THEME_MODULE = path.join(process.cwd(), process.env.THEME_MODULE); // Use current working directory (i.e. the theme folder) to complete module path
20
20
  const visualsTestModulePath = fileURLToPath(new URL('..', import.meta.url));
21
21
  const binaryPath = fileURLToPath(new URL('../node_modules/.bin', import.meta.url));
22
- const workingDir = fileURLToPath(new URL('../node_modules/@public-ui/sample-react', import.meta.url));
22
+
23
+ let sampleReactPath = '../node_modules/@public-ui/sample-react';
24
+ let backSteps = ``;
25
+ let workingDir = null;
26
+ do {
27
+ const url = new URL(backSteps + sampleReactPath, import.meta.url);
28
+ workingDir = fileURLToPath(url);
29
+ backSteps += `../`;
30
+ } while (!fs.existsSync(workingDir) && path.resolve(process.cwd(), backSteps) !== '/');
31
+
32
+ if (!fs.existsSync(workingDir)) {
33
+ throw new Error('Could not find React Sample App package. Please install it with "npm install @public-ui/sample-react".');
34
+ }
35
+
23
36
  const buildPath = path.join(tempDir, `kolibri-visual-testing-build-${crypto.randomUUID()}`);
24
- const packageJsonPath = await import(new URL('../node_modules/@public-ui/sample-react/package.json', import.meta.url), {
37
+ const packageJsonPath = await import(new URL(`${workingDir}/package.json`, import.meta.url), {
25
38
  assert: { type: 'json' },
26
39
  });
27
40