From efd4c5b340e3ea09703c5ef7b4bd319ae6d825c6 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 3 Jul 2024 02:57:05 -0700 Subject: [PATCH] Remove API test infrastructure --- bin/test_api.js | 74 ------------------------------------------------- package.json | 4 --- 2 files changed, 78 deletions(-) delete mode 100644 bin/test_api.js diff --git a/bin/test_api.js b/bin/test_api.js deleted file mode 100644 index bdfbc7af..00000000 --- a/bin/test_api.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2019 The xterm.js authors. All rights reserved. - * @license MIT - */ - -const cp = require('child_process'); -const path = require('path'); - - -// Add `out` to the NODE_PATH so absolute paths can be resolved. -const env = { ...process.env }; -env.NODE_PATH = path.resolve(__dirname, '../out'); - -let testFiles = [ - './addons/**/out-test/*api.js', - './out-test/**/*api.js', -]; - - -let flagArgs = []; - -if (process.argv.length > 2) { - const args = process.argv.slice(2); - flagArgs = args.filter(e => e.startsWith('--')).map(arg => arg.split('=')).reduce((arr, val) => arr.concat(val.slice(), [])); - console.info(flagArgs); - // ability to inject particular test files via - // yarn test [testFileA testFileB ...] - files = args.filter(e => !e.startsWith('--')); - if (files.length) { - testFiles = files; - } -} - - - -env.DEBUG = flagArgs.indexOf('--debug') >= 0 ? 'debug' : ''; -env.PORT = 3001; - -const server = cp.spawn('node', ['demo/start'], { - cwd: path.resolve(__dirname, '..'), - env, - stdio: 'pipe' -}) - -server.stdout.on('data', (data) => { - // await for the server to fully start - if (data.includes("successfully")) { - const run = cp.spawnSync( - npmBinScript('mocha'), - [...testFiles, ...flagArgs], { - cwd: path.resolve(__dirname, '..'), - env, - shell: true, - stdio: 'inherit' - } - ); - - function npmBinScript(script) { - return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ? - `${script}.cmd` : script)); - } - - server.kill(); - - if (run.error) { - console.error(run.error); - } - process.exit(run.status ?? -1); - } -}); - -server.stderr.on('data', (data) => { - console.error(data.toString()); -}); diff --git a/package.json b/package.json index 5e15baee..c1320d60 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,6 @@ "lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/", "test": "npm run test-unit", "posttest": "npm run lint", - "test-api": "npm run test-api-chromium", - "test-api-chromium": "node ./bin/test_api.js --browser=chromium --timeout=20000", - "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=ChromeStable\"", "test-playwright-firefox": "node ./bin/test_playwright.js --workers=75% \"--project=FirefoxStable\"",