From 7b9977053d978cce46d76badfae22d64c24288a3 Mon Sep 17 00:00:00 2001 From: Tian Feng Date: Fri, 16 Aug 2024 16:24:47 -0700 Subject: [PATCH] remove useless file --- .github/workflows/test.yml | 2 +- .husky/pre-push | 2 +- bin/testcafe | 5 ---- package.json | 6 ++--- src/runner.ts | 55 -------------------------------------- 5 files changed, 4 insertions(+), 66 deletions(-) delete mode 100755 bin/testcafe delete mode 100644 src/runner.ts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c17a7aee..94707adb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,7 @@ jobs: run: npm run build - name: Unit Test - run: npm run unit-test + run: npm run test - name: Integration Test run: npm run integration-test diff --git a/.husky/pre-push b/.husky/pre-push index ff0069d0..879e9351 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -npm run unit-test +npm run test diff --git a/bin/testcafe b/bin/testcafe deleted file mode 100755 index 9907d8bc..00000000 --- a/bin/testcafe +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -const { testCafeRunner } = require('../lib/runner'); - -(async () => await testCafeRunner())(); diff --git a/package.json b/package.json index f974b42f..0d75bafb 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,12 @@ "author": "", "license": "MIT", "private": true, - "bin": "./bin/testcafe", - "main": "lib/runner.js", + "main": "lib/testcafe-runner.js", "scripts": { "build": "tsc && cp src/sauce-testcafe-config.cjs lib/", - "test": "node lib/runner.js", + "test": "jest --env node", "lint": "prettier --check '**/*.{js,ts,mjs,cjs}' && eslint .", "fmt": "prettier --write '**/*.{js,ts,mjs,cjs}'", - "unit-test": "jest --env node", "integration-test": "bash ./tests/run.sh" }, "keywords": [ diff --git a/src/runner.ts b/src/runner.ts deleted file mode 100644 index 1ec4cd13..00000000 --- a/src/runner.ts +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env node -import fs from 'fs'; -import path from 'path'; -import child_process from 'child_process'; -import * as utils from 'sauce-testrunner-utils'; -import { TestCafeConfig } from './type'; - -async function testCafeRunner() { - const { runCfgPath } = utils.getArgs(); - const runCfgAbsolutePath = utils.getAbsolutePath(runCfgPath); - const runCfg = await utils.loadRunConfig(runCfgAbsolutePath); - const p = new Promise((resolve, reject) => { - (runCfg as TestCafeConfig).path = runCfgPath; - const assetsPath = path.join( - path.dirname(runCfgAbsolutePath), - (runCfg as TestCafeConfig).projectPath || '.', - '__assets__', - ); - if (!fs.existsSync(assetsPath)) { - fs.mkdirSync(assetsPath); - } - - const [nodeBin] = process.argv; - const testcafeRunnerEntry = path.join(__dirname, 'testcafe-runner.js'); - const child = child_process.spawn(nodeBin, [ - testcafeRunnerEntry, - ...process.argv.slice(2), - ]); - - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); - - child.on('exit', (exitCode: number) => { - if (exitCode === 0) { - resolve(); - } else { - reject(exitCode); - } - }); - }); - return await p; -} - -if (require.main === module) { - testCafeRunner() - .then(() => { - process.exit(0); - }) - .catch((err) => { - console.error(err); - process.exit(err); - }); -} - -module.exports = { testCafeRunner };