Skip to content

Commit ac215cf

Browse files
authored
Ensure run_changed errors on packages without test script (#3068)
1 parent 94ee69a commit ac215cf

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

packages-exp/firebase-exp/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
"build": "rollup -c && gulp firebase-js",
3131
"build:release": "rollup -c rollup.config.release.js && gulp firebase-js",
3232
"dev": "rollup -c -w",
33-
"prepare": "yarn build:release"
33+
"prepare": "yarn build:release",
34+
"test": "echo 'No test suite for firebase wrapper'",
35+
"test:ci": "echo 'No test suite for firebase wrapper'"
3436
},
3537
"dependencies": {
3638
"@firebase/app-exp": "0.0.800"

packages/firebase/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
"build": "rollup -c",
3737
"build:deps": "lerna run --scope firebase --include-dependencies build",
3838
"dev": "rollup -c -w",
39-
"prepare": "yarn build"
39+
"prepare": "yarn build",
40+
"test": "echo 'No test suite for firebase wrapper'",
41+
"test:ci": "echo 'No test suite for firebase wrapper'"
4042
},
4143
"main": "dist/index.node.cjs.js",
4244
"browser": "dist/index.cjs.js",

packages/webchannel-wrapper/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"scripts": {
1313
"dev": "watch 'yarn build' src",
1414
"build": "gulp",
15-
"prepare": "yarn build"
15+
"prepare": "yarn build",
16+
"test": "echo 'No test suite for webchannel-wrapper'",
17+
"test:ci": "echo 'No test suite for webchannel-wrapper'"
1618
},
1719
"license": "Apache-2.0",
1820
"devDependencies": {

scripts/run_changed.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const git = simpleGit(root);
2525

2626
// use test:ci command in CI
2727
const testCommand = !!process.env.CI ? 'test:ci' : 'test';
28+
2829
/**
2930
* Changes to these files warrant running all tests.
3031
*/
@@ -104,10 +105,8 @@ async function getChangedPackages() {
104105
if (match && match[1]) {
105106
const changedPackage = require(resolve(root, match[1], 'package.json'));
106107
if (changedPackage) {
107-
if (changedPackage.scripts.test) {
108-
// Add the package itself.
109-
changedPackages[match[1]] = 'direct';
110-
}
108+
// Add the package itself.
109+
changedPackages[match[1]] = 'direct';
111110
// Add packages that depend on it.
112111
for (const package in depGraph) {
113112
if (depGraph[package].includes(changedPackage.name)) {
@@ -117,7 +116,7 @@ async function getChangedPackages() {
117116
depData.location,
118117
'package.json'
119118
));
120-
if (depPkgJson && depPkgJson.scripts.test) {
119+
if (depPkgJson) {
121120
const depPath = depData.location.replace(`${root}/`, '');
122121
if (!changedPackages[depPath]) {
123122
changedPackages[depPath] = 'dependency';
@@ -154,7 +153,7 @@ async function runTests(pathList) {
154153
stdio: 'inherit'
155154
});
156155
} catch (e) {
157-
throw new Error(`Error running tests in ${testPath}.`);
156+
throw new Error(`Error running "yarn ${testCommand}" in ${testPath}.`);
158157
}
159158
}
160159
}
@@ -186,7 +185,7 @@ async function main() {
186185
await runTests(Object.keys(changedPackages));
187186
}
188187
} catch (e) {
189-
console.error(e);
188+
console.error(chalk`{red ${e}}`);
190189
process.exit(1);
191190
}
192191
}

0 commit comments

Comments
 (0)