Skip to content
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

🏗 During PR checks, first run the tests changed by the PR (if any) #15461

Merged
merged 1 commit into from May 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions build-system/pr-check.js
Expand Up @@ -321,6 +321,9 @@ const command = {
// stopSauceConnect();
// }
},
runUnitTestsOnLocalChanges: function() {
timedExecOrDie('gulp test --nobuild --headless --local-changes');
},
runIntegrationTests: function(compiled) {
// Integration tests on chrome, or on all saucelabs browsers if set up
let cmd = 'gulp test --integration --nobuild';
Expand Down Expand Up @@ -598,6 +601,8 @@ function main() {
command.runDepAndTypeChecks();
// Run unit tests only if the PR contains runtime changes.
if (buildTargets.has('RUNTIME')) {
// Before running all tests, run tests modified by the PR. (Fail early.)
command.runUnitTestsOnLocalChanges();
command.runUnitTests();
}
}
Expand Down
11 changes: 6 additions & 5 deletions build-system/tasks/runtime-test.js
Expand Up @@ -175,7 +175,7 @@ function printArgvMessages() {
log(green('⤷ Use'), cyan('--local-changes'),
green('to run unit tests from files commited to the local branch.'));
}
if (!argv.testnames && !argv.files) {
if (!argv.testnames && !argv.files && !argv['local-changes']) {
log(green('⤷ Use'), cyan('--testnames'),
green('to see the names of all tests being run.'));
}
Expand Down Expand Up @@ -266,7 +266,7 @@ function runTests() {
c.client.captureConsole = true;
}

if (argv.testnames || argv['local-changes']) {
if (!process.env.TRAVIS && (argv.testnames || argv['local-changes'])) {
c.reporters = ['mocha'];
}

Expand Down Expand Up @@ -379,9 +379,10 @@ function runTests() {
refreshKarmaWdCache();

// On Travis, collapse the summary printed by the 'karmaSimpleReporter'
// reporter, since it likely contains copious amounts of logs.
const shouldCollapseSummary =
process.env.TRAVIS && c.reporters.includes('karmaSimpleReporter');
// reporter for full unit test runs, since it likely contains copious amounts
// of logs.
const shouldCollapseSummary = process.env.TRAVIS &&
c.reporters.includes('karmaSimpleReporter') && !argv['local-changes'];
const sectionMarker =
(argv.saucelabs || argv.saucelabs_lite) ? 'saucelabs' : 'local';

Expand Down