test(docs-infra): ensure RxJS-related docs examples can compile without errors (#34063)

Previously, some RxJS-related examples (which are not proper Angular apps) were not
tested on CI as part of the `example-e2e` npm script. This meant that the examples
could get out-of-date or contain compile errors without as noticing.

This commit ensures that the `example-e2e` script picks up these examples and checks
that they compile successfully.

Partly addresses #28017.

PR Close #34063
This commit is contained in:
Sonu Kapoor 2019-11-26 14:11:45 -05:00 committed by Miško Hevery
parent 3408468121
commit 2cc954d5a5
12 changed files with 91 additions and 14 deletions

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/observables-in-angular/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -39,9 +39,9 @@ export class ZippyComponent {
Time: {{ time | async }}</div>`
})
export class AsyncObservablePipeComponent {
time = new Observable(observer =>
setInterval(() => observer.next(new Date().toString()), 1000)
);
time = new Observable<string>(observer => {
setInterval(() => observer.next(new Date().toString()), 1000);
});
}
// #enddocregion pipe

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/observables/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/practical-observable-usage/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -1,12 +1,12 @@
import { fromEvent } from 'rxjs';
import { ajax } from 'rxjs/ajax';
import { map, filter, debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
import { debounceTime, distinctUntilChanged, filter, map, switchMap } from 'rxjs/operators';
const searchBox = document.getElementById('search-box');
const typeahead = fromEvent(searchBox, 'input').pipe(
map((e: KeyboardEvent) => e.target.value),
map((e: KeyboardEvent) => (e.target as HTMLInputElement).value),
filter(text => text.length > 2),
debounceTime(10),
distinctUntilChanged(),

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/rx-libary/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -58,8 +58,8 @@
"@types/express": "^4.0.35",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "^2.0.4",
"@types/jquery": "^3.3.4",
"@types/node": "~8.9.4",
"@types/jquery":"3.3.28",
"@types/node":"~12.12.14",
"canonical-path": "1.0.0",
"concurrently": "^3.0.0",
"http-server": "^0.11.1",

View File

@ -443,9 +443,12 @@
dependencies:
"@types/jasmine" "*"
"@types/jquery@^3.3.4":
version "3.3.4"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.4.tgz#f1850fb9a70041a14ace4f81a7ed782db8548317"
"@types/jquery@3.3.28":
version "3.3.28"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.28.tgz#e4e4e1a72a890b9d5fce34019d961265dd1394c4"
integrity sha512-6+0asQBU38H5kdoKvxVGE7fY8JREBgQsxONw0na0noV9D3JLN2+odBPKkTvRcLW20xSNiP8BH0nyl+8PcIHYNw==
dependencies:
"@types/sizzle" "*"
"@types/mime@*":
version "2.0.0"
@ -465,9 +468,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.3.tgz#7c6b0f8eaf16ae530795de2ad1b85d34bf2f5c58"
integrity sha512-wp6IOGu1lxsfnrD+5mX6qwSwWuqsdkKKxTN4aQc4wByHAKZJf9/D4KXPQ1POUjEbnCP5LMggB0OEFNY9OTsMqg==
"@types/node@~8.9.4":
version "8.9.5"
resolved "https://registry.npmjs.org/@types/node/-/node-8.9.5.tgz#162b864bc70be077e6db212b322754917929e976"
"@types/node@~12.12.14":
version "12.12.14"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.14.tgz#1c1d6e3c75dba466e0326948d56e8bd72a1903d2"
integrity sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==
"@types/q@^0.0.32":
version "0.0.32"
@ -484,6 +488,11 @@
"@types/express-serve-static-core" "*"
"@types/mime" "*"
"@types/sizzle@*":
version "2.3.2"
resolved "https://registry.yarnpkg.com/@types/sizzle/-/sizzle-2.3.2.tgz#a811b8c18e2babab7d542b3365887ae2e4d9de47"
integrity sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==
"@types/source-list-map@*":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"