From 8660806ddc247d2ec48f60e741c1bfe409096728 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Mon, 23 Mar 2020 17:31:56 +0200 Subject: [PATCH] build(docs-infra): renamed `e2e` property of `example-config.json` to `tests` (#36143) Each docs example has an `example-config.json` configuration file. Among other things, this file can be used to specify what commands to run in order to test the example. (If not specified, the `run-example-e2e.js` script will run a default `yarn e2e` command.) Previously, the property specifying the test commands was called `e2e`. This is because in the past only e2e tests were run for docs examples. Since recently, some examples may specify commands for other types of tests (such as unit tests). Therefore, calling the property that holds the list of test commands `e2e` no longer makes sense and can be misleading to people looking at the configuration files. This commit renamed the property to the more generic `tests`. In the future, the `run-example-e2e.js` script (and corresponding npm script) should be renamed and refactored to also avoid giving the impression that only e2e tests are run. Discussed in: https://github.com/angular/angular/pull/36143#discussion_r395148379 PR Close #36143 --- .../examples/component-interaction/example-config.json | 2 +- aio/content/examples/forms-overview/example-config.json | 2 +- aio/content/examples/http/example-config.json | 2 +- aio/content/examples/i18n/example-config.json | 2 +- .../examples/observables-in-angular/example-config.json | 2 +- aio/content/examples/observables/example-config.json | 2 +- .../examples/practical-observable-usage/example-config.json | 2 +- aio/content/examples/rx-library/example-config.json | 2 +- .../service-worker-getting-started/example-config.json | 2 +- aio/content/examples/setup/example-config.json | 2 +- aio/content/examples/testing/example-config.json | 2 +- aio/content/examples/toh-pt6/example-config.json | 2 +- aio/tools/examples/run-example-e2e.js | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/aio/content/examples/component-interaction/example-config.json b/aio/content/examples/component-interaction/example-config.json index d56f4ce8b0..05e262817d 100644 --- a/aio/content/examples/component-interaction/example-config.json +++ b/aio/content/examples/component-interaction/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ { "cmd": "yarn", "args": [ diff --git a/aio/content/examples/forms-overview/example-config.json b/aio/content/examples/forms-overview/example-config.json index a3fb39d2be..5f2a94dfa8 100644 --- a/aio/content/examples/forms-overview/example-config.json +++ b/aio/content/examples/forms-overview/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ {"cmd": "yarn", "args": ["test", "--browsers=ChromeHeadless", "--no-watch"]}, {"cmd": "yarn", "args": ["e2e", "--prod", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]} ] diff --git a/aio/content/examples/http/example-config.json b/aio/content/examples/http/example-config.json index f6afa36536..f000fdf0b1 100644 --- a/aio/content/examples/http/example-config.json +++ b/aio/content/examples/http/example-config.json @@ -1,6 +1,6 @@ { "projectType": "testing", - "e2e": [ + "tests": [ {"cmd": "yarn", "args": ["test", "--browsers=ChromeHeadless", "--no-watch"]}, {"cmd": "yarn", "args": ["e2e", "--prod", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]} ] diff --git a/aio/content/examples/i18n/example-config.json b/aio/content/examples/i18n/example-config.json index 408f4c2d0c..4ff904f875 100644 --- a/aio/content/examples/i18n/example-config.json +++ b/aio/content/examples/i18n/example-config.json @@ -1,6 +1,6 @@ { "projectType": "i18n", - "e2e": [ + "tests": [ { "cmd": "yarn", "args": [ diff --git a/aio/content/examples/observables-in-angular/example-config.json b/aio/content/examples/observables-in-angular/example-config.json index f2b127257b..c07fa9794c 100644 --- a/aio/content/examples/observables-in-angular/example-config.json +++ b/aio/content/examples/observables-in-angular/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ { "cmd": "yarn", "args": [ "tsc", "--project", "./tsconfig.app.json" ] diff --git a/aio/content/examples/observables/example-config.json b/aio/content/examples/observables/example-config.json index f2b127257b..c07fa9794c 100644 --- a/aio/content/examples/observables/example-config.json +++ b/aio/content/examples/observables/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ { "cmd": "yarn", "args": [ "tsc", "--project", "./tsconfig.app.json" ] diff --git a/aio/content/examples/practical-observable-usage/example-config.json b/aio/content/examples/practical-observable-usage/example-config.json index f2b127257b..c07fa9794c 100644 --- a/aio/content/examples/practical-observable-usage/example-config.json +++ b/aio/content/examples/practical-observable-usage/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ { "cmd": "yarn", "args": [ "tsc", "--project", "./tsconfig.app.json" ] diff --git a/aio/content/examples/rx-library/example-config.json b/aio/content/examples/rx-library/example-config.json index f2b127257b..c07fa9794c 100644 --- a/aio/content/examples/rx-library/example-config.json +++ b/aio/content/examples/rx-library/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ { "cmd": "yarn", "args": [ "tsc", "--project", "./tsconfig.app.json" ] diff --git a/aio/content/examples/service-worker-getting-started/example-config.json b/aio/content/examples/service-worker-getting-started/example-config.json index f6a1e8b458..ad715b0711 100644 --- a/aio/content/examples/service-worker-getting-started/example-config.json +++ b/aio/content/examples/service-worker-getting-started/example-config.json @@ -1,6 +1,6 @@ { "projectType": "service-worker", - "e2e": [ + "tests": [ {"cmd": "yarn", "args": ["e2e", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]}, {"cmd": "yarn", "args": ["build", "--prod"]}, {"cmd": "node", "args": ["--eval", "assert(fs.existsSync('./dist/ngsw.json'), 'ngsw.json is missing')"]}, diff --git a/aio/content/examples/setup/example-config.json b/aio/content/examples/setup/example-config.json index a3fb39d2be..5f2a94dfa8 100644 --- a/aio/content/examples/setup/example-config.json +++ b/aio/content/examples/setup/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ {"cmd": "yarn", "args": ["test", "--browsers=ChromeHeadless", "--no-watch"]}, {"cmd": "yarn", "args": ["e2e", "--prod", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]} ] diff --git a/aio/content/examples/testing/example-config.json b/aio/content/examples/testing/example-config.json index f6afa36536..f000fdf0b1 100644 --- a/aio/content/examples/testing/example-config.json +++ b/aio/content/examples/testing/example-config.json @@ -1,6 +1,6 @@ { "projectType": "testing", - "e2e": [ + "tests": [ {"cmd": "yarn", "args": ["test", "--browsers=ChromeHeadless", "--no-watch"]}, {"cmd": "yarn", "args": ["e2e", "--prod", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]} ] diff --git a/aio/content/examples/toh-pt6/example-config.json b/aio/content/examples/toh-pt6/example-config.json index a3fb39d2be..5f2a94dfa8 100644 --- a/aio/content/examples/toh-pt6/example-config.json +++ b/aio/content/examples/toh-pt6/example-config.json @@ -1,5 +1,5 @@ { - "e2e": [ + "tests": [ {"cmd": "yarn", "args": ["test", "--browsers=ChromeHeadless", "--no-watch"]}, {"cmd": "yarn", "args": ["e2e", "--prod", "--protractor-config=e2e/protractor-puppeteer.conf.js", "--no-webdriver-update", "--port={PORT}"]} ] diff --git a/aio/tools/examples/run-example-e2e.js b/aio/tools/examples/run-example-e2e.js index 0c202226d5..d3bef17584 100644 --- a/aio/tools/examples/run-example-e2e.js +++ b/aio/tools/examples/run-example-e2e.js @@ -265,7 +265,7 @@ function runE2eTestsCLI(appDir, outputFile, bufferOutput, port) { // `--no-webdriver-update` is needed to preserve the ChromeDriver version already installed. const config = loadExampleConfig(appDir); - const commands = config.e2e || [{ + const testCommands = config.tests || [{ cmd: 'yarn', args: [ 'e2e', @@ -277,7 +277,7 @@ function runE2eTestsCLI(appDir, outputFile, bufferOutput, port) { }]; let bufferedOutput = `\n\n============== AIO example output for: ${appDir}\n\n`; - const e2eSpawnPromise = commands.reduce((prevSpawnPromise, {cmd, args}) => { + const e2eSpawnPromise = testCommands.reduce((prevSpawnPromise, {cmd, args}) => { // Replace the port placeholder with the specified port if present. Specs that // define their e2e test commands in the example config are able to use the // given available port. This ensures that the CLI tests can be run concurrently.