any-browser 1.0.4 → 1.0.6

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.
package/README.md CHANGED
@@ -121,11 +121,6 @@ sudo apt-get install -y libpcre3 libicu66 libwebp6 libenchant1c2a libffi7
121
121
  For other distributions, check your package manager's docs, or just run
122
122
  `npx playwright install-deps` and let Playwright figure it out.
123
123
 
124
- ## Publishing / Releasing
125
-
126
- See [PUBLISHING.md](./PUBLISHING.md) for the one-time npm/GitHub setup and the
127
- release workflow.
128
-
129
124
  ---
130
125
 
131
126
  If this helped, consider starring ⭐ the repository to support the project! 😊
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "any-browser",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Test your website across Safari (WebKit), Firefox, and Chrome with one CLI command.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/runner.js CHANGED
@@ -1,7 +1,25 @@
1
1
  import { spawn } from 'node:child_process';
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
2
5
  import pc from 'picocolors';
3
6
  import { resolveBrowsers, ENGINE_LABELS } from './browsers.js';
4
7
 
8
+ const require = createRequire(import.meta.url);
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+
11
+ // The config and tests live inside this package, not in whatever folder the
12
+ // user happens to be running `any-browser` from — so we resolve absolute
13
+ // paths to both instead of letting Playwright guess based on cwd.
14
+ const CONFIG_PATH = join(__dirname, '..', 'playwright.config.js');
15
+
16
+ function resolvePlaywrightCli() {
17
+ const pkgJsonPath = require.resolve('@playwright/test/package.json');
18
+ const pkg = require(pkgJsonPath);
19
+ const binFile = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin.playwright;
20
+ return join(dirname(pkgJsonPath), binFile);
21
+ }
22
+
5
23
  export async function runTests(browserArgs, options) {
6
24
  const { resolved, unknown } = resolveBrowsers(browserArgs);
7
25
 
@@ -29,17 +47,17 @@ function runOne(engine, options) {
29
47
  return new Promise((resolve) => {
30
48
  console.log(pc.bold(`\nā–¶ ${ENGINE_LABELS[engine]} (${engine})`));
31
49
 
32
- const args = ['playwright', 'test', `--project=${engine}`];
50
+ const cliPath = resolvePlaywrightCli();
51
+ const args = ['test', `--project=${engine}`, `--config=${CONFIG_PATH}`];
33
52
  if (!options.headless) args.push('--headed');
34
53
 
35
- const child = spawn('npx', args, {
54
+ const child = spawn(process.execPath, [cliPath, ...args], {
36
55
  stdio: 'inherit',
37
56
  env: {
38
57
  ...process.env,
39
58
  TEST_URL: options.url,
40
59
  TEST_HEADLESS: options.headless ? '1' : '0',
41
60
  },
42
- shell: process.platform === 'win32',
43
61
  });
44
62
 
45
63
  child.on('close', (code) => {