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
This commit is contained in:
George Kalpakas 2020-03-23 17:31:56 +02:00 committed by Kara Erickson
parent 4c5e085c93
commit 8660806ddc
13 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,5 @@
{
"e2e": [
"tests": [
{
"cmd": "yarn",
"args": [

View File

@ -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}"]}
]

View File

@ -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}"]}
]

View File

@ -1,6 +1,6 @@
{
"projectType": "i18n",
"e2e": [
"tests": [
{
"cmd": "yarn",
"args": [

View File

@ -1,5 +1,5 @@
{
"e2e": [
"tests": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./tsconfig.app.json" ]

View File

@ -1,5 +1,5 @@
{
"e2e": [
"tests": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./tsconfig.app.json" ]

View File

@ -1,5 +1,5 @@
{
"e2e": [
"tests": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./tsconfig.app.json" ]

View File

@ -1,5 +1,5 @@
{
"e2e": [
"tests": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./tsconfig.app.json" ]

View File

@ -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')"]},

View File

@ -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}"]}
]

View File

@ -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}"]}
]

View File

@ -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}"]}
]

View File

@ -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.