Skip to content

Commit

Permalink
Merge pull request xtermjs#5078 from Tyriar/shell_tests
Browse files Browse the repository at this point in the history
Get tests working on node that requires shell arg
  • Loading branch information
Tyriar authored Jul 2, 2024
2 parents f77a763 + daa2440 commit 50032e2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
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

0 comments on commit 50032e2

Please sign in to comment.