Skip to content

Ensure run_changed errors on packages without test script #3068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages-exp/firebase-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"build": "rollup -c && gulp firebase-js",
"build:release": "rollup -c rollup.config.release.js && gulp firebase-js",
"dev": "rollup -c -w",
"prepare": "yarn build:release"
"prepare": "yarn build:release",
"test": "echo 'No test suite for firebase wrapper'",
"test:ci": "echo 'No test suite for firebase wrapper'"
},
"dependencies": {
"@firebase/app-exp": "0.0.800"
Expand Down
4 changes: 3 additions & 1 deletion packages/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"build": "rollup -c",
"build:deps": "lerna run --scope firebase --include-dependencies build",
"dev": "rollup -c -w",
"prepare": "yarn build"
"prepare": "yarn build",
"test": "echo 'No test suite for firebase wrapper'",
"test:ci": "echo 'No test suite for firebase wrapper'"
},
"main": "dist/index.node.cjs.js",
"browser": "dist/index.cjs.js",
Expand Down
4 changes: 3 additions & 1 deletion packages/webchannel-wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"scripts": {
"dev": "watch 'yarn build' src",
"build": "gulp",
"prepare": "yarn build"
"prepare": "yarn build",
"test": "echo 'No test suite for webchannel-wrapper'",
"test:ci": "echo 'No test suite for webchannel-wrapper'"
},
"license": "Apache-2.0",
"devDependencies": {
Expand Down
13 changes: 6 additions & 7 deletions scripts/run_changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const git = simpleGit(root);

// use test:ci command in CI
const testCommand = !!process.env.CI ? 'test:ci' : 'test';
// const testCommand = 'print';
/**
* Changes to these files warrant running all tests.
*/
Expand Down Expand Up @@ -104,10 +105,8 @@ async function getChangedPackages() {
if (match && match[1]) {
const changedPackage = require(resolve(root, match[1], 'package.json'));
if (changedPackage) {
if (changedPackage.scripts.test) {
// Add the package itself.
changedPackages[match[1]] = 'direct';
}
// Add the package itself.
changedPackages[match[1]] = 'direct';
// Add packages that depend on it.
for (const package in depGraph) {
if (depGraph[package].includes(changedPackage.name)) {
Expand All @@ -117,7 +116,7 @@ async function getChangedPackages() {
depData.location,
'package.json'
));
if (depPkgJson && depPkgJson.scripts.test) {
if (depPkgJson) {
const depPath = depData.location.replace(`${root}/`, '');
if (!changedPackages[depPath]) {
changedPackages[depPath] = 'dependency';
Expand Down Expand Up @@ -154,7 +153,7 @@ async function runTests(pathList) {
stdio: 'inherit'
});
} catch (e) {
throw new Error(`Error running tests in ${testPath}.`);
throw new Error(`Error running "yarn ${testCommand}" in ${testPath}.`);
}
}
}
Expand Down Expand Up @@ -186,7 +185,7 @@ async function main() {
await runTests(Object.keys(changedPackages));
}
} catch (e) {
console.error(e);
console.error(chalk`{red ${e}}`);
process.exit(1);
}
}
Expand Down