Allow option to run template test on individual files

Also adds some basic documentation on using the bazel test target.

Sample usage:
bazel test //polygerrit-ui/app:template_test --test_output errors \
--test_arg=gr-list-view

Change-Id: I013f4c4e8411b6f34afb31e9baae3bb30dea5ad4
This commit is contained in:
Becky Siegel
2017-08-14 13:51:24 -07:00
parent 000ad99e84
commit 00136aacd1
3 changed files with 36 additions and 2 deletions

View File

@@ -42,9 +42,21 @@ fs.readdir('./polygerrit-ui/temp/behaviors/', (err, data) => {
});
}
const mappings = JSON.parse(fs.readFileSync(
let mappings = JSON.parse(fs.readFileSync(
`./polygerrit-ui/temp/map.json`, 'utf-8'));
// If a particular file was passed by the user, don't test everything.
const file = process.argv[2];
if (file) {
const mappingSpecificFile = {};
for (key of Object.keys(mappings)) {
if (key.includes(file)) {
mappingSpecificFile[key] = mappings[key];
}
}
mappings = mappingSpecificFile;
}
externs.push({
path: 'custom-externs.js',
src: '/** @externs */' +