Each example also provides tests (mostly e2e and occasionally unit tests), which are run as part of our CircleCI `test_docs_examples*` jobs, to verify that the examples continue to work as expected, as changes are made to the core Angular libraries.
There are also different project types, each with its own boilerplate.
For example, there are projects based on the Angular CLI, projects that use AngularJS, Custom Elements, i18n, server-side rendering, etc.
(See the [example configuration section](#example-config) below for more info on how to specify the project type.)
To avoid having to maintain the boilerplate in each example, we use the [example-boilerplate-js](./example-boilerplate.js) script to provide a set of files that works across all the examples of a specific type.
-`build: string`: The npm script to run in order to build the example app.
Default: `"build"`
-`run: string`: The npm script to run in order to serve the example app (so that e2e test can be run against it).
Default `"serve:e2e"`
**CLI-only properties:**
-`tests: object[]`: An array of objects, each specifying a test command. This can be used to run multiple test commands in series (for example, to run unit and e2e tests).
The commands are specified as `{cmd: string, args: string[]}` and must be in a format that could be passed to Node.js' `child_process.spawn(cmd, args)`. You can use a special `{PORT}` placeholder, that will be replaced with the port on which the app is served during the actual test.
The [example-boilerplate.js](./example-boilerplate.js) script that adds boilerplate to examples.
It is used by the Bazel build behind the scenes, but can also be invoked via `yarn example-list-overrides` to print a list of all example files that override boilerplate files.
The [run-example-e2e.mjs](./run-example-e2e.mjs) script will find and run the e2e tests for a single example. Although it only runs e2e tests by default, it can be configured to run any test command (for CLI-based examples) by using the `tests` property of the [example-config.json](#example-config) file.
The [create-example-playground.mjs](./create-example-playground.mjs) script combines example sources, boilerplate, and shared node_modules deps into git-ignored playground directory `content/example-playground/{{EXAMPLE}}` that can be used for manual testing. This should be invoked via the yarn script:
```bash
yarn example-playground <exampleName> [--local]
```
The `--local` flag links in locally-built angular packages as dependencies.