Skip to content

Commit

Permalink
build: add flag for running tests with ViewEngine (angular#19056)
Browse files Browse the repository at this point in the history
Proxies the `config` flag in the test command so that we're able to switch between Ivy and ViewEngine.
  • Loading branch information
crisbeto committed Apr 17, 2020
1 parent 7d47b45 commit f020403
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/run-component-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ shelljs.set('-e');
shelljs.cd(projectDir);

// Extracts the supported command line options.
const {_: components, local, firefox, watch} = minimist(args, {
boolean: ['local', 'firefox', 'watch'],
default: {watch: true},
const {_: components, local, firefox, watch, 'view-engine': viewEngine} = minimist(args, {
boolean: ['local', 'firefox', 'watch', 'view-engine'],
default: {watch: true, 'view-engine': false},
});

// Whether tests for all components should be run.
Expand All @@ -64,13 +64,14 @@ if (local && (components.length > 1 || all)) {
const bazelBinary = `yarn -s ${watch ? 'ibazel' : 'bazel'}`;
const testTargetName =
`unit_tests_${local ? 'local' : firefox ? 'firefox-local' : 'chromium-local'}`;
const configFlag = viewEngine ? '--config=view-engine' : '';

// If `all` has been specified as component, we run tests for all components
// in the repository. The `--firefox` flag can be still specified.
if (all) {
shelljs.exec(
`${bazelBinary} test //src/... --test_tag_filters=-e2e,-browser:${testTargetName} ` +
`--build_tag_filters=-browser:${testTargetName} --build_tests_only`);
`--build_tag_filters=-browser:${testTargetName} --build_tests_only ${configFlag}`);
return;
}

Expand All @@ -92,7 +93,7 @@ const testLabels = components
.map(t => `${getBazelPackageOfComponentName(t)}:${testTargetName}`);

// Runs Bazel for the determined test labels.
shelljs.exec(`${bazelBinary} ${bazelAction} ${testLabels.join(' ')}`);
shelljs.exec(`${bazelBinary} ${bazelAction} ${testLabels.join(' ')} ${configFlag}`);

/**
* Gets the Bazel package label for the specified component name. Throws if
Expand Down

0 comments on commit f020403

Please sign in to comment.