Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get tests working on node that requires shell arg #5078

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/addon-canvas/test/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const config: PlaywrightTestConfig = {
timeout: 10000,
projects: [
{
name: 'Chrome Stable',
name: 'ChromeStable',
use: {
browserName: 'chromium',
channel: 'chrome'
}
},
{
name: 'Firefox Stable',
name: 'FirefoxStable',
use: {
browserName: 'firefox'
}
Expand Down
4 changes: 2 additions & 2 deletions addons/addon-webgl/test/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const config: PlaywrightTestConfig = {
timeout: 10000,
projects: [
{
name: 'Chrome Stable',
name: 'ChromeStable',
use: {
browserName: 'chromium',
channel: 'chrome'
}
},
{
name: 'Firefox Stable',
name: 'FirefoxStable',
use: {
browserName: 'firefox'
}
Expand Down
10 changes: 7 additions & 3 deletions bin/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const cp = require('child_process');
const path = require('path');

const COVERAGE_LINES_THRESHOLD = 60;
const COVERAGE_LINES_THRESHOLD = 40;

// Add `out` to the NODE_PATH so absolute paths can be resolved.
const env = { ...process.env };
Expand All @@ -31,7 +31,6 @@ if (process.argv.length > 2) {
}

const checkCoverage = flagArgs.indexOf('--coverage') >= 0;

if (checkCoverage) {
flagArgs.splice(flagArgs.indexOf('--coverage'), 1);
const executable = npmBinScript('nyc');
Expand All @@ -44,6 +43,7 @@ if (checkCoverage) {
{
cwd: path.resolve(__dirname, '..'),
env,
shell: true,
stdio: 'inherit'
}
);
Expand All @@ -56,6 +56,7 @@ const run = cp.spawnSync(
{
cwd: path.resolve(__dirname, '..'),
env,
shell: true,
stdio: 'inherit'
}
);
Expand All @@ -64,4 +65,7 @@ function npmBinScript(script) {
return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ? `${script}.cmd` : script));
}

process.exit(run.status);
if (run.error) {
console.error(run.error);
}
process.exit(run.status ?? -1);
6 changes: 5 additions & 1 deletion bin/test_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ server.stdout.on('data', (data) => {
[...testFiles, ...flagArgs], {
cwd: path.resolve(__dirname, '..'),
env,
shell: true,
stdio: 'inherit'
}
);
Expand All @@ -61,7 +62,10 @@ server.stdout.on('data', (data) => {

server.kill();

process.exit(run.status);
if (run.error) {
console.error(run.error);
}
process.exit(run.status ?? -1);
}
});

Expand Down
7 changes: 5 additions & 2 deletions bin/test_playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ async function run() {
console.log(`\n\x1b[32m${command}\x1b[0m`, args);
const run = cp.spawnSync(command, args, {
cwd: path.resolve(__dirname, '..'),
shell: true,
stdio: 'inherit'
}
);
if (run.status) {
process.exit(run.status);

if (run.error) {
console.error(run.error);
}
process.exit(run.status ?? -1);
}
}
run();
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"test-api-firefox": "node ./bin/test_api.js --browser=firefox --timeout=20000",
"test-api-webkit": "node ./bin/test_api.js --browser=webkit --timeout=20000",
"test-playwright": "node ./bin/test_playwright.js --workers=75%",
"test-playwright-chromium": "node ./bin/test_playwright.js --workers=75% \"--project=Chrome Stable\"",
"test-playwright-firefox": "node ./bin/test_playwright.js --workers=75% \"--project=Firefox Stable\"",
"test-playwright-chromium": "node ./bin/test_playwright.js --workers=75% \"--project=ChromeStable\"",
"test-playwright-firefox": "node ./bin/test_playwright.js --workers=75% \"--project=FirefoxStable\"",
"test-playwright-webkit": "node ./bin/test_playwright.js --workers=75% \"--project=WebKit\"",
"test-playwright-debug": "node ./bin/test_playwright.js --workers=1 --headed --timeout=30000",
"test-unit": "node ./bin/test.js",
Expand Down
4 changes: 2 additions & 2 deletions test/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const config: PlaywrightTestConfig = {
timeout: 10000,
projects: [
{
name: 'Chrome Stable',
name: 'ChromeStable',
use: {
browserName: 'chromium',
channel: 'chrome'
}
},
{
name: 'Firefox Stable',
name: 'FirefoxStable',
use: {
browserName: 'firefox'
}
Expand Down
Loading