Skip to content

Commit 04d4f97

Browse files
authored
Hide messages from build tools and test runners for passed packages (#2988)
* Hide messages from build tools and test runners for passed packages * [AUTOMATED]: Prettier Code Styling * [AUTOMATED]: License Headers * [AUTOMATED]: API Reports * revert * rename variable
1 parent ccb9bf9 commit 04d4f97

File tree

27 files changed

+83
-8
lines changed

27 files changed

+83
-8
lines changed

.github/workflows/test-all.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: yarn build
2525
run: yarn build
2626
- name: Run unit tests
27-
run: xvfb-run yarn test
27+
run: xvfb-run yarn test:ci
2828
- name: Generate coverage file
2929
run: yarn ci:coverage
3030
- name: Run coverage

integration/browserify/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"version": "0.2.1",
55
"scripts": {
66
"pretest": "mkdirp dist && browserify src/namespace.test.js -o dist/namespace.test.js",
7-
"test": "karma start --single-run"
7+
"test": "karma start --single-run",
8+
"test:ci": "node ../../scripts/run_tests_in_ci.js"
89
},
910
"dependencies": {
1011
"firebase": "7.14.2"

integration/firebase-typings/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"private": true,
44
"version": "0.2.1",
55
"scripts": {
6-
"test": "tsc"
6+
"test": "tsc",
7+
"test:ci": "node ../../scripts/run_tests_in_ci.js"
78
},
89
"dependencies": {
910
"firebase": "7.14.2"

integration/firestore/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"build:persistence": "INCLUDE_FIRESTORE_PERSISTENCE=true gulp compile-tests",
88
"build:memory": "INCLUDE_FIRESTORE_PERSISTENCE=false gulp compile-tests",
99
"test": "yarn build:memory; karma start --single-run; yarn build:persistence; karma start --single-run;",
10+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
1011
"test:persistence": " yarn build:persistence; karma start --single-run",
1112
"test:memory": "yarn build:memory; karma start --single-run",
1213
"test:debug:persistence": "yarn build:deps; yarn build:persistence; karma start --auto-watch --browsers Chrome",

integration/typescript/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"private": true,
44
"version": "0.2.1",
55
"scripts": {
6-
"test": "karma start --single-run"
6+
"test": "karma start --single-run",
7+
"test:ci": "node ../../scripts/run_tests_in_ci.js"
78
},
89
"dependencies": {
910
"firebase": "7.14.2"

integration/webpack/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"scripts": {
66
"pretest": "webpack",
7-
"test": "karma start --single-run"
7+
"test": "karma start --single-run",
8+
"test:ci": "node ../../scripts/run_tests_in_ci.js"
89
},
910
"dependencies": {
1011
"firebase": "7.14.2"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"release": "node scripts/release/cli.js",
3131
"pretest": "node tools/pretest.js",
3232
"test": "lerna run --concurrency 4 --stream test",
33+
"test:ci": "lerna run --concurrency 4 --stream test:ci",
3334
"test:exp": "lerna run --concurrency 4 --stream --scope @firebase/*-exp --scope firebase-exp test",
3435
"pretest:coverage": "mkdirp coverage",
3536
"ci:coverage": "lcov-result-merger 'packages/**/lcov.info' 'lcov-all.info'",

packages-exp/app-exp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"build:deps": "lerna run --scope @firebase/app-exp --include-dependencies build",
2020
"dev": "rollup -c -w",
2121
"test": "yarn type-check && run-p lint test:browser test:node",
22+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2223
"test:browser": "karma start --single-run",
2324
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js",
2425
"type-check": "tsc -p . --noEmit",

packages/analytics/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"build:deps": "lerna run --scope @firebase/'{app,analytics}' --include-dependencies build",
1717
"dev": "rollup -c -w",
1818
"test": "yarn type-check && yarn run-p lint test:browser",
19+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
1920
"test:browser": "karma start --single-run --nocache",
2021
"type-check": "tsc -p . --noEmit",
2122
"prepare": "yarn build"

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"build:deps": "lerna run --scope @firebase/app --include-dependencies build",
2121
"dev": "rollup -c -w",
2222
"test": "yarn type-check && run-p lint test:browser test:node",
23+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2324
"type-check": "tsc -p . --noEmit",
2425
"test:browser": "karma start --single-run",
2526
"test:browser:debug": "karma start --browsers Chrome --auto-watch",

packages/auth/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"generate-test-files": "./buildtools/generate_test_files.sh",
1717
"prepare": "yarn build",
1818
"serve": "yarn build && yarn generate-test-files && gulp serve",
19-
"test": "yarn generate-test-files && ./buildtools/run_tests.sh"
19+
"test": "yarn generate-test-files && ./buildtools/run_tests.sh",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js"
2021
},
2122
"license": "Apache-2.0",
2223
"dependencies": {

packages/component/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:deps": "lerna run --scope @firebase/component --include-dependencies build",
1818
"dev": "rollup -c -w",
1919
"test": "yarn type-check && run-p lint test:browser test:node",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2021
"type-check": "tsc -p . --noEmit",
2122
"test:browser": "karma start --single-run",
2223
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js",

packages/database/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:deps": "lerna run --scope @firebase/'{app,database}' --include-dependencies build",
1818
"dev": "rollup -c -w",
1919
"test": "run-p lint test:emulator",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2021
"test:all": "run-p lint test:browser test:node",
2122
"test:browser": "karma start --single-run",
2223
"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",

packages/firestore/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1818
"prettier": "prettier --write '*.ts' '*.js' 'src/**/*.js' 'test/**/*.js' 'src/**/*.ts' 'test/**/*.ts'",
1919
"test": "run-s lint test:all",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2021
"test:all": "run-p test:browser test:travis test:minified",
2122
"test:browser": "karma start --single-run",
2223
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",

packages/functions/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:deps": "lerna run --scope @firebase/'{app,functions}' --include-dependencies build",
1818
"dev": "rollup -c -w",
1919
"test": "yarn type-check && run-p lint test:browser test:node",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2021
"type-check": "tsc -p . --noEmit",
2122
"test:browser": "karma start --single-run",
2223
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",

packages/installations/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"build": "rollup -c",
1414
"build:deps": "lerna run --scope @firebase/'{app,installations}' --include-dependencies build",
1515
"test": "yarn type-check && yarn test:karma && yarn lint",
16+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
1617
"test:karma": "karma start --single-run",
1718
"test:debug": "karma start --browsers=Chrome --auto-watch",
1819
"type-check": "tsc -p . --noEmit",

packages/logger/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"build:deps": "lerna run --scope @firebase/logger --include-dependencies build",
1717
"dev": "rollup -c -w",
1818
"test": "run-p lint test:browser test:node",
19+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
1920
"test:browser": "karma start --single-run",
2021
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
2122
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --config ../../config/mocharc.node.js",

packages/messaging/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"build:deps": "lerna run --scope @firebase/'{app,messaging}' --include-dependencies build",
1717
"dev": "rollup -c -w",
1818
"test": "run-p test:karma type-check lint",
19+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
1920
"test:karma": "karma start --single-run",
2021
"test:debug": "karma start --browsers=Chrome --auto-watch",
2122
"prepare": "yarn build",

packages/performance/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:deps": "lerna run --scope @firebase/'{app,performance}' --include-dependencies build",
1818
"dev": "rollup -c -w",
1919
"test": "run-p lint test:browser",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2021
"test:browser": "karma start --single-run",
2122
"test:debug": "karma start --browsers=Chrome --auto-watch",
2223
"prepare": "yarn build",

packages/remote-config/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:deps": "lerna run --scope @firebase/'{app,remote-config}' --include-dependencies build",
1818
"dev": "rollup -c -w",
1919
"test": "run-p lint test:browser",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2021
"test:browser": "karma start --single-run",
2122
"test:debug": "karma start --browsers=Chrome --auto-watch",
2223
"prettier": "prettier --write '{src,test}/**/*.{js,ts}'",

packages/rxfire/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"dev": "rollup -c -w",
2929
"prepare": "yarn build",
3030
"test": "run-p lint test:browser",
31+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
3132
"test:browser": "karma start --single-run",
3233
"test:browser:debug": "karma start --browsers=Chrome --auto-watch"
3334
},

packages/storage/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"build:deps": "lerna run --scope @firebase/'{app,storage}' --include-dependencies build",
1717
"dev": "rollup -c -w",
1818
"test": "run-p test:browser lint",
19+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
1920
"test:browser": "karma start --single-run",
2021
"prepare": "yarn build",
2122
"prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'"

packages/template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"build:deps": "lerna run --scope @firebase/'{app,template}' --include-dependencies build",
1919
"dev": "rollup -c -w",
2020
"test": "yarn type-check && run-p lint test:browser test:node",
21+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2122
"test:browser": "karma start --single-run",
2223
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --config ../../config/mocharc.node.js",
2324
"type-check": "tsc -p . --noEmit",

packages/testing/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"build:deps": "lerna run --scope @firebase/testing --include-dependencies build",
1616
"dev": "rollup -c -w",
1717
"test": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js",
18+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
1819
"prepare": "yarn build"
1920
},
2021
"license": "Apache-2.0",

packages/util/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:deps": "lerna run --scope @firebase/util --include-dependencies build",
1818
"dev": "rollup -c -w",
1919
"test": "yarn type-check && run-p lint test:browser test:node",
20+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2021
"type-check": "tsc -p . --noEmit",
2122
"test:browser": "karma start --single-run",
2223
"test:node": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --config ../../config/mocharc.node.js",

scripts/run_changed.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const simpleGit = require('simple-git/promise');
2323
const root = resolve(__dirname, '..');
2424
const git = simpleGit(root);
2525

26+
// use test:ci command in CI
27+
const testCommand = !!process.env.CI ? 'test:ci' : 'test';
2628
/**
2729
* Changes to these files warrant running all tests.
2830
*/
@@ -148,7 +150,7 @@ async function runTests(pathList) {
148150
if (!pathList) return;
149151
for (const testPath of pathList) {
150152
try {
151-
await spawn('yarn', ['--cwd', testPath, 'test'], {
153+
await spawn('yarn', ['--cwd', testPath, testCommand], {
152154
stdio: 'inherit'
153155
});
154156
} catch (e) {
@@ -161,7 +163,7 @@ async function main() {
161163
try {
162164
const { testAll, changedPackages = {} } = await getChangedPackages();
163165
if (testAll) {
164-
await spawn('yarn', ['test'], {
166+
await spawn('yarn', [testCommand], {
165167
stdio: 'inherit'
166168
});
167169
} else {
@@ -178,6 +180,8 @@ async function main() {
178180
console.log(chalk`{yellow ${filename} (depends on modified files)}`);
179181
}
180182
}
183+
184+
changedPackages['packages/app'] = 'direct';
181185
await runTests(alwaysRunTestPaths);
182186
await runTests(Object.keys(changedPackages));
183187
}

scripts/run_tests_in_ci.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
const { argv } = require('yargs');
19+
const path = require('path');
20+
const { spawn } = require('child-process-promise');
21+
22+
(async () => {
23+
const myPath = argv._[0] || '.'; // default to the current directory
24+
const dir = path.resolve(myPath);
25+
const { name } = require(`${dir}/package.json`);
26+
27+
let stdout = '';
28+
let stderr = '';
29+
try {
30+
const testProcess = spawn('yarn', ['--cwd', dir, 'test']);
31+
32+
testProcess.childProcess.stdout.on('data', data => {
33+
stdout += data.toString();
34+
});
35+
testProcess.childProcess.stderr.on('data', data => {
36+
stderr += data.toString();
37+
});
38+
39+
await testProcess;
40+
console.log('Success: ' + name);
41+
} catch (e) {
42+
console.error('Failure: ' + name);
43+
console.log(stdout);
44+
console.error(stderr);
45+
process.exit(1);
46+
}
47+
})();

0 commit comments

Comments
 (0)