diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000..45422454a08 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,19 @@ +name: Lint All Packages + +on: push + +jobs: + test: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Node (10) + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: yarn install + run: yarn + - name: yarn lint + run: yarn lint diff --git a/integration/browserify/package.json b/integration/browserify/package.json index c509cd6f0c3..5771b0776c2 100644 --- a/integration/browserify/package.json +++ b/integration/browserify/package.json @@ -5,7 +5,7 @@ "scripts": { "pretest": "mkdirp dist && browserify src/namespace.test.js -o dist/namespace.test.js", "test": "karma start --single-run", - "test:ci": "node ../../scripts/run_tests_in_ci.js" + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test" }, "devDependencies": { "firebase": "7.18.0", diff --git a/integration/firebase-typings/package.json b/integration/firebase-typings/package.json index 39f896b1156..0adb887f1c5 100644 --- a/integration/firebase-typings/package.json +++ b/integration/firebase-typings/package.json @@ -4,7 +4,7 @@ "version": "0.2.1", "scripts": { "test": "tsc", - "test:ci": "node ../../scripts/run_tests_in_ci.js" + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test" }, "devDependencies": { "firebase": "7.18.0", diff --git a/integration/firestore/package.json b/integration/firestore/package.json index 1d87200a8bf..aa66d258b59 100644 --- a/integration/firestore/package.json +++ b/integration/firestore/package.json @@ -7,7 +7,7 @@ "build:persistence": "INCLUDE_FIRESTORE_PERSISTENCE=true gulp compile-tests", "build:memory": "INCLUDE_FIRESTORE_PERSISTENCE=false gulp compile-tests", "test": "yarn build:memory; karma start --single-run; yarn build:persistence; karma start --single-run;", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test", "test:persistence": " yarn build:persistence; karma start --single-run", "test:persistence:debug:": "yarn build:persistence; karma start --auto-watch --browsers Chrome", "test:memory": "yarn build:memory; karma start --single-run", diff --git a/integration/typescript/package.json b/integration/typescript/package.json index fae78a79da0..4392b4e162a 100644 --- a/integration/typescript/package.json +++ b/integration/typescript/package.json @@ -4,7 +4,7 @@ "version": "0.2.1", "scripts": { "test": "karma start --single-run", - "test:ci": "node ../../scripts/run_tests_in_ci.js" + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test" }, "devDependencies": { "firebase": "7.18.0", diff --git a/integration/webpack/package.json b/integration/webpack/package.json index 18362cfc35e..14e4ced18fc 100644 --- a/integration/webpack/package.json +++ b/integration/webpack/package.json @@ -5,7 +5,7 @@ "scripts": { "pretest": "webpack", "test": "karma start --single-run", - "test:ci": "node ../../scripts/run_tests_in_ci.js" + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test" }, "devDependencies": { "firebase": "7.18.0", diff --git a/package.json b/package.json index e860b5dcb60..496a57f5bf8 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,9 @@ "release": "ts-node-script scripts/release/cli.ts", "pretest": "node tools/pretest.js", "test": "lerna run --concurrency 4 --stream test", - "test:ci": "lerna run --concurrency 4 --stream test:ci", - "test:release": "lerna run --concurrency 4 --ignore @firebase/*-exp --ignore firebase-exp --stream test:ci", - "test:exp": "lerna run --concurrency 4 --stream --scope @firebase/*-exp --scope firebase-exp test", + "test:ci": "lerna run --concurrency 4 test:ci", + "test:release": "lerna run --concurrency 4 --ignore @firebase/*-exp --ignore firebase-exp test:ci", + "test:exp": "lerna run --concurrency 4 --scope @firebase/*-exp --scope firebase-exp --stream test", "pretest:coverage": "mkdirp coverage", "ci:coverage": "lcov-result-merger 'packages/**/lcov.info' 'lcov-all.info'", "test:coverage": "lcov-result-merger 'packages/**/lcov.info' | coveralls", diff --git a/packages-exp/app-exp/package.json b/packages-exp/app-exp/package.json index 0618df6bf81..e4543ec13db 100644 --- a/packages-exp/app-exp/package.json +++ b/packages-exp/app-exp/package.json @@ -16,11 +16,11 @@ "build:release": "rollup -c rollup.config.release.js && yarn api-report && yarn typings:public", "build:deps": "lerna run --scope @firebase/app-exp --include-dependencies build", "dev": "rollup -c -w", - "test": "yarn type-check && run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test": "run-p lint test:all", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", + "test:all": "run-p test:browser test:node", "test:browser": "karma start --single-run", "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js", - "type-check": "tsc -p . --noEmit", "prepare": "rollup -c rollup.config.release.js && yarn api-report", "api-report": "api-extractor run --local --verbose", "predoc": "node ../../scripts/exp/remove-exp.js temp", diff --git a/packages-exp/functions-exp/package.json b/packages-exp/functions-exp/package.json index c70fd443b39..8802b5438f7 100644 --- a/packages-exp/functions-exp/package.json +++ b/packages-exp/functions-exp/package.json @@ -16,9 +16,9 @@ "build:deps": "lerna run --scope @firebase/functions-exp --include-dependencies build", "build:release": "rollup -c rollup.config.release.js && yarn api-report", "dev": "rollup -c -w", - "test": "yarn type-check && run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", - "type-check": "tsc -p . --noEmit", + "test": "run-p lint test:all", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", + "test:all": "run-p test:browser test:node", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers=Chrome --auto-watch", "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'src/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js", diff --git a/packages/analytics/package.json b/packages/analytics/package.json index 88e893134d1..0cfd7787dab 100644 --- a/packages/analytics/package.json +++ b/packages/analytics/package.json @@ -13,10 +13,9 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/'{app,analytics}' --include-dependencies build", "dev": "rollup -c -w", - "test": "yarn type-check && yarn run-p lint test:browser", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test": "run-p lint test:browser", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", "test:browser": "karma start --single-run --nocache", - "type-check": "tsc -p . --noEmit", "prepare": "yarn build" }, "peerDependencies": { diff --git a/packages/app/package.json b/packages/app/package.json index 35e746e8c60..0a1eb86e2bf 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -17,9 +17,9 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/app --include-dependencies build", "dev": "rollup -c -w", - "test": "yarn type-check && run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", - "type-check": "tsc -p . --noEmit", + "test": "run-p lint test:all", + "test:all": "run-p test:browser test:node", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers Chrome --auto-watch", "test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --config ../../config/mocharc.node.js", diff --git a/packages/component/package.json b/packages/component/package.json index bfcaccff3e1..8a67ac48378 100644 --- a/packages/component/package.json +++ b/packages/component/package.json @@ -14,9 +14,9 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/component --include-dependencies build", "dev": "rollup -c -w", - "test": "yarn type-check && run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", - "type-check": "tsc -p . --noEmit", + "test": "run-p lint test:all", + "test:all": "run-p test:browser test:node", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", "test:browser": "karma start --single-run", "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js", "prepare": "yarn build" diff --git a/packages/database/package.json b/packages/database/package.json index bbef697b955..9eddd4a6083 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -15,7 +15,7 @@ "build:deps": "lerna run --scope @firebase/'{app,database}' --include-dependencies build", "dev": "rollup -c -w", "test": "run-p lint test:emulator", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:emulator", "test:all": "run-p lint test:browser test:node", "test:browser": "karma start --single-run", "test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file index.node.ts --config ../../config/mocharc.node.js", diff --git a/packages/firestore/package.json b/packages/firestore/package.json index 55dc000af56..5fb522a08b6 100644 --- a/packages/firestore/package.json +++ b/packages/firestore/package.json @@ -36,7 +36,7 @@ "test:exp:browser": "karma start --single-run --exp", "test:exp:browser:debug": "karma start --single-run --exp --auto-watch", "test": "run-s lint test:all", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", "test:all": "run-p test:browser test:lite:browser test:exp:browser test:travis test:minified", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers=Chrome --auto-watch", diff --git a/packages/functions/package.json b/packages/functions/package.json index 5bf885cd6f2..92dbe936989 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -14,9 +14,9 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/'{app,functions}' --include-dependencies build", "dev": "rollup -c -w", - "test": "yarn type-check && run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", - "type-check": "tsc -p . --noEmit", + "test": "run-p lint test:all", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", + "test:all": "run-p test:browser test:node", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers=Chrome --auto-watch", "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file index.node.ts --config ../../config/mocharc.node.js", diff --git a/packages/installations/package.json b/packages/installations/package.json index f8628d1e2f5..a7b9635c7fc 100644 --- a/packages/installations/package.json +++ b/packages/installations/package.json @@ -12,11 +12,10 @@ "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", "build": "rollup -c", "build:deps": "lerna run --scope @firebase/'{app,installations}' --include-dependencies build", - "test": "yarn type-check && yarn test:karma && yarn lint", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test": "run-p lint test:karma", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:karma", "test:karma": "karma start --single-run", "test:debug": "karma start --browsers=Chrome --auto-watch", - "type-check": "tsc -p . --noEmit", "serve": "yarn serve:build && yarn serve:host", "serve:build": "rollup -c test-app/rollup.config.js", "serve:host": "http-server -c-1 test-app", diff --git a/packages/logger/package.json b/packages/logger/package.json index 566ce999236..b8e11c31d2e 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -13,8 +13,9 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/logger --include-dependencies build", "dev": "rollup -c -w", - "test": "run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test": "run-p lint test:all", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", + "test:all": "run-p test:browser test:node", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers Chrome --auto-watch", "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --config ../../config/mocharc.node.js", diff --git a/packages/messaging/package.json b/packages/messaging/package.json index 4c9a9548c28..395641236fa 100644 --- a/packages/messaging/package.json +++ b/packages/messaging/package.json @@ -13,13 +13,12 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/'{app,messaging}' --include-dependencies build", "dev": "rollup -c -w", - "test": "run-p test:karma type-check lint ", - "test:integration": "run-p test:karma type-check lint && cd ../../integration/messaging && npm run-script test", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test": "run-p lint test:karma", + "test:integration": "test:karma && cd ../../integration/messaging && npm run-script test", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:karma", "test:karma": "karma start --single-run", "test:debug": "karma start --browsers=Chrome --auto-watch", - "prepare": "yarn build", - "type-check": "tsc --noEmit" + "prepare": "yarn build" }, "license": "Apache-2.0", "peerDependencies": { diff --git a/packages/performance/package.json b/packages/performance/package.json index 2e5a1dc7111..1e0504a19b0 100644 --- a/packages/performance/package.json +++ b/packages/performance/package.json @@ -15,7 +15,7 @@ "build:deps": "lerna run --scope @firebase/'{app,performance}' --include-dependencies build", "dev": "rollup -c -w", "test": "run-p lint test:browser", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", "test:browser": "karma start --single-run", "test:debug": "karma start --browsers=Chrome --auto-watch", "prepare": "yarn build", diff --git a/packages/remote-config/package.json b/packages/remote-config/package.json index 67ce4b215b0..713476efc45 100644 --- a/packages/remote-config/package.json +++ b/packages/remote-config/package.json @@ -15,7 +15,7 @@ "build:deps": "lerna run --scope @firebase/'{app,remote-config}' --include-dependencies build", "dev": "rollup -c -w", "test": "run-p lint test:browser", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", "test:browser": "karma start --single-run", "test:debug": "karma start --browsers=Chrome --auto-watch", "prettier": "prettier --write '{src,test}/**/*.{js,ts}'", diff --git a/packages/rules-unit-testing/package.json b/packages/rules-unit-testing/package.json index aec07b80eec..bddc1c2fe84 100644 --- a/packages/rules-unit-testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -16,7 +16,7 @@ "dev": "rollup -c -w", "test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js", "test": "firebase --debug emulators:exec 'yarn test:nyc'", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test", "prepare": "yarn build" }, "license": "Apache-2.0", diff --git a/packages/rxfire/package.json b/packages/rxfire/package.json index c94257e7901..77502f664ed 100644 --- a/packages/rxfire/package.json +++ b/packages/rxfire/package.json @@ -28,7 +28,7 @@ "dev": "rollup -c -w", "prepare": "yarn build", "test": "run-p lint test:browser", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers=Chrome --auto-watch" }, diff --git a/packages/storage/package.json b/packages/storage/package.json index 629b199a393..66627b54379 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -14,7 +14,7 @@ "build:deps": "lerna run --scope @firebase/'{app,storage}' --include-dependencies build", "dev": "rollup -c -w", "test": "run-p test:browser lint", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", "test:browser:unit": "karma start --single-run --unit", "test:browser:integration": "karma start --single-run --integration", "test:browser": "karma start --single-run", diff --git a/packages/template/package.json b/packages/template/package.json index 1bdd8dce645..a478b7c092c 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -17,11 +17,11 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/'{app,template}' --include-dependencies build", "dev": "rollup -c -w", - "test": "yarn type-check && run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test": "run-p lint test:all", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", + "test:all": "run-p test:browser test:node", "test:browser": "karma start --single-run", "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --config ../../config/mocharc.node.js", - "type-check": "tsc -p . --noEmit", "prepare": "yarn build" }, "peerDependencies": { diff --git a/packages/testing/package.json b/packages/testing/package.json index c9b4ad0ba98..2916ce2539f 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -14,7 +14,7 @@ "dev": "rollup -c -w", "test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js", "test": "firebase --debug emulators:exec 'yarn test:nyc'", - "test:ci": "node ../../scripts/run_tests_in_ci.js", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test", "prepare": "yarn build" }, "license": "Apache-2.0", diff --git a/packages/util/package.json b/packages/util/package.json index 757fc6a29ea..f22ec8111a6 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -14,9 +14,9 @@ "build": "rollup -c", "build:deps": "lerna run --scope @firebase/util --include-dependencies build", "dev": "rollup -c -w", - "test": "yarn type-check && run-p lint test:browser test:node", - "test:ci": "node ../../scripts/run_tests_in_ci.js", - "type-check": "tsc -p . --noEmit", + "test": "run-p lint test:all", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", + "test:all": "run-p test:browser test:node", "test:browser": "karma start --single-run", "test:node": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --config ../../config/mocharc.node.js", "prepare": "yarn build" diff --git a/repo-scripts/changelog-generator/index.ts b/repo-scripts/changelog-generator/index.ts index d23b90c3aec..1eaf2ca5b43 100644 --- a/repo-scripts/changelog-generator/index.ts +++ b/repo-scripts/changelog-generator/index.ts @@ -30,13 +30,15 @@ const changelogFunctions: ChangelogFunctions = { 'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]' ); } - if (dependenciesUpdated.length === 0) return ''; + if (dependenciesUpdated.length === 0) { + return ''; + } const changesetLink = `- Updated dependencies [${( await Promise.all( changesets.map(async cs => { if (cs.commit) { - let { links } = await getInfo({ + const { links } = await getInfo({ repo: options.repo, commit: cs.commit }); @@ -65,7 +67,7 @@ const changelogFunctions: ChangelogFunctions = { .map(l => l.trimRight()); if (changeset.commit) { - let { pull: pullNumber, links } = await getInfo({ + const { pull: pullNumber, links } = await getInfo({ repo: options.repo, commit: changeset.commit }); diff --git a/repo-scripts/changelog-generator/package.json b/repo-scripts/changelog-generator/package.json index 0de8422f506..08fea8e1412 100644 --- a/repo-scripts/changelog-generator/package.json +++ b/repo-scripts/changelog-generator/package.json @@ -13,9 +13,8 @@ "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", "build": "tsc", "build:dev": "tsc -w", - "test": "yarn type-check", - "prepare": "yarn build", - "type-check": "tsc -p . --noEmit" + "test": "tsc -p . --noEmit", + "prepare": "yarn build" }, "dependencies": { "@changesets/types": "3.1.0", diff --git a/repo-scripts/size-analysis/package.json b/repo-scripts/size-analysis/package.json index eec2eb34335..8ce1baead2e 100644 --- a/repo-scripts/size-analysis/package.json +++ b/repo-scripts/size-analysis/package.json @@ -10,10 +10,10 @@ "scripts": { "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", - "pretest": "tsc -p test/test-inputs && rollup -c", - "test": "yarn type-check && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha **/*.test.ts --config ../../config/mocharc.node.js --timeout 60000", - "test:ci": "node ../../scripts/run_tests_in_ci.js", - "type-check": "tsc -p . --noEmit" + "test": "run-p lint test:node", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:node", + "pretest:node": "tsc -p test/test-inputs && rollup -c", + "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha **/*.test.ts --config ../../config/mocharc.node.js --timeout 60000" }, "dependencies": { "typescript": "3.9.7", diff --git a/scripts/run_tests_in_ci.js b/scripts/run_tests_in_ci.js index 6adb20e4699..7272fafd952 100644 --- a/scripts/run_tests_in_ci.js +++ b/scripts/run_tests_in_ci.js @@ -15,19 +15,33 @@ * limitations under the License. */ -const { argv } = require('yargs'); +const yargs = require('yargs'); const path = require('path'); const { spawn } = require('child-process-promise'); +const argv = yargs.options({ + d: { + type: 'string', + desc: 'current working directory', + default: '.' + }, + s: { + type: 'string', + desc: 'the npm script to run', + default: 'test' + } +}).argv; + (async () => { - const myPath = argv._[0] || '.'; // default to the current directory + const myPath = argv.d; + const scriptName = argv.s; const dir = path.resolve(myPath); const { name } = require(`${dir}/package.json`); let stdout = ''; let stderr = ''; try { - const testProcess = spawn('yarn', ['--cwd', dir, 'test']); + const testProcess = spawn('yarn', ['--cwd', dir, scriptName]); testProcess.childProcess.stdout.on('data', data => { stdout += data.toString();