Skip to content

Commit 7f72c01

Browse files
committed
test(@angular/cli): add npm_integration_test
1 parent 43a2dd1 commit 7f72c01

35 files changed

+10718
-1
lines changed

integration/angular_cli/.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

integration/angular_cli/.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
9+
10+
# dependencies
11+
/node_modules
12+
13+
# profiling files
14+
chrome-profiler-events*.json
15+
speed-measure-plugin*.json
16+
17+
# IDEs and editors
18+
/.idea
19+
.project
20+
.classpath
21+
.c9/
22+
*.launch
23+
.settings/
24+
*.sublime-workspace
25+
26+
# IDE - VSCode
27+
.vscode/*
28+
!.vscode/settings.json
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
31+
!.vscode/extensions.json
32+
.history/*
33+
34+
# misc
35+
/.sass-cache
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
npm-debug.log
40+
yarn-error.log
41+
testem.log
42+
/typings
43+
44+
# System Files
45+
.DS_Store
46+
Thumbs.db

integration/angular_cli/BUILD.bazel

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
load("//tools/npm_integration_test:npm_integration_test.bzl", "npm_integration_test")
2+
3+
filegroup(
4+
name = "angular_cli_sources",
5+
srcs = glob(
6+
include = ["**/*"],
7+
exclude = [
8+
"node_modules/**",
9+
".yarn_local_cache/**",
10+
],
11+
),
12+
)
13+
14+
npm_integration_test(
15+
name = "angular_cli_test",
16+
check_npm_packages = [
17+
"@angular/cli",
18+
"@angular-devkit/architect",
19+
"@angular-devkit/build-angular",
20+
"@angular-devkit/build-webpack",
21+
"@angular-devkit/build-optimizer",
22+
"@angular-devkit/core",
23+
"@angular-devkit/schematics",
24+
"@schematics/angular",
25+
"@schematics/update",
26+
],
27+
commands = [
28+
# Workaround https://github.com/yarnpkg/yarn/issues/2165
29+
# Yarn will cache file://dist URIs and not update
30+
"rm -rf ./.yarn_local_cache",
31+
"mkdir .yarn_local_cache",
32+
"patch-package-json",
33+
"$(rootpath @nodejs//:yarn_bin) install --cache-folder ./.yarn_local_cache",
34+
"$(rootpath @nodejs//:yarn_bin) --cache-folder ./.yarn_local_cache ng version",
35+
"rm -rf ./.yarn_local_cache",
36+
],
37+
data = [
38+
"@nodejs//:yarn_bin",
39+
"@nodejs//:yarn_files",
40+
],
41+
npm_packages = {
42+
"//packages/angular/cli:npm_package_archive": "@angular/cli",
43+
"//packages/angular_devkit/architect:npm_package_archive": "@angular-devkit/architect",
44+
"//packages/angular_devkit/build_angular:npm_package_archive": "@angular-devkit/build-angular",
45+
"//packages/angular_devkit/core:npm_package_archive": "@angular-devkit/core",
46+
"//packages/angular_devkit/schematics:npm_package_archive": "@angular-devkit/schematics",
47+
"//packages/angular_devkit/build_optimizer:npm_package_archive": "@angular-devkit/build-optimizer",
48+
"//packages/angular_devkit/build_webpack:npm_package_archive": "@angular-devkit/build-webpack",
49+
"//packages/ngtools/webpack:npm_package_archive": "@ngtools/webpack",
50+
"//packages/schematics/angular:npm_package_archive": "@schematics/angular",
51+
"//packages/schematics/update:npm_package_archive": "@schematics/update",
52+
},
53+
test_files = ":angular_cli_sources",
54+
)

integration/angular_cli/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# IntegrationProject
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

integration/angular_cli/angular.json

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"integration-project": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/integration-project",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "tsconfig.app.json",
21+
"aot": true,
22+
"assets": [
23+
"src/favicon.ico",
24+
"src/assets"
25+
],
26+
"styles": [
27+
"src/styles.css"
28+
],
29+
"scripts": []
30+
},
31+
"configurations": {
32+
"production": {
33+
"fileReplacements": [
34+
{
35+
"replace": "src/environments/environment.ts",
36+
"with": "src/environments/environment.prod.ts"
37+
}
38+
],
39+
"optimization": true,
40+
"outputHashing": "all",
41+
"sourceMap": false,
42+
"extractCss": true,
43+
"namedChunks": false,
44+
"extractLicenses": true,
45+
"vendorChunk": false,
46+
"buildOptimizer": true,
47+
"budgets": [
48+
{
49+
"type": "initial",
50+
"maximumWarning": "2mb",
51+
"maximumError": "5mb"
52+
},
53+
{
54+
"type": "anyComponentStyle",
55+
"maximumWarning": "6kb",
56+
"maximumError": "10kb"
57+
}
58+
]
59+
}
60+
}
61+
},
62+
"serve": {
63+
"builder": "@angular-devkit/build-angular:dev-server",
64+
"options": {
65+
"browserTarget": "integration-project:build"
66+
},
67+
"configurations": {
68+
"production": {
69+
"browserTarget": "integration-project:build:production"
70+
}
71+
}
72+
},
73+
"extract-i18n": {
74+
"builder": "@angular-devkit/build-angular:extract-i18n",
75+
"options": {
76+
"browserTarget": "integration-project:build"
77+
}
78+
},
79+
"test": {
80+
"builder": "@angular-devkit/build-angular:karma",
81+
"options": {
82+
"main": "src/test.ts",
83+
"polyfills": "src/polyfills.ts",
84+
"tsConfig": "tsconfig.spec.json",
85+
"karmaConfig": "karma.conf.js",
86+
"assets": [
87+
"src/favicon.ico",
88+
"src/assets"
89+
],
90+
"styles": [
91+
"src/styles.css"
92+
],
93+
"scripts": []
94+
}
95+
},
96+
"lint": {
97+
"builder": "@angular-devkit/build-angular:tslint",
98+
"options": {
99+
"tsConfig": [
100+
"tsconfig.app.json",
101+
"tsconfig.spec.json",
102+
"e2e/tsconfig.json"
103+
],
104+
"exclude": [
105+
"**/node_modules/**"
106+
]
107+
}
108+
},
109+
"e2e": {
110+
"builder": "@angular-devkit/build-angular:protractor",
111+
"options": {
112+
"webdriverUpdate": false,
113+
"protractorConfig": "e2e/protractor.conf.js",
114+
"devServerTarget": "integration-project:serve"
115+
},
116+
"configurations": {
117+
"production": {
118+
"devServerTarget": "integration-project:serve:production"
119+
}
120+
}
121+
}
122+
}
123+
}
124+
},
125+
"defaultProject": "integration-project",
126+
"cli": {
127+
"analytics": false
128+
}
129+
}

integration/angular_cli/browserslist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# You can see what browsers were selected by your queries by running:
6+
# npx browserslist
7+
8+
> 0.5%
9+
last 2 versions
10+
Firefox ESR
11+
not dead
12+
not IE 9-11 # For IE 9-11 support, remove 'not'.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// @ts-check
2+
// Protractor configuration file, see link for more information
3+
// https://github.com/angular/protractor/blob/master/lib/config.ts
4+
5+
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
6+
const { resolve } = require('path');
7+
8+
exports.config = {
9+
allScriptsTimeout: 11000,
10+
specs: ['./**/*.e2e-spec.ts'],
11+
capabilities: {
12+
browserName: 'chrome',
13+
chromeOptions: {
14+
args: ['--headless', '--disable-gpu', '--window-size=800,600'],
15+
binary: require('puppeteer').executablePath(),
16+
},
17+
},
18+
directConnect: true,
19+
baseUrl: 'http://localhost:4200/',
20+
framework: 'jasmine',
21+
jasmineNodeOpts: {
22+
showColors: true,
23+
defaultTimeoutInterval: 30000,
24+
print: function () { },
25+
},
26+
onPrepare() {
27+
require('ts-node').register({
28+
project: resolve(__dirname, './tsconfig.json'),
29+
});
30+
jasmine.getEnv().addReporter(new SpecReporter({
31+
spec: {
32+
displayStacktrace: StacktraceOption.PRETTY
33+
}
34+
}));
35+
},
36+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { AppPage } from './app.po';
2+
import { browser, logging } from 'protractor';
3+
4+
describe('workspace-project App', () => {
5+
let page: AppPage;
6+
7+
beforeEach(() => {
8+
page = new AppPage();
9+
});
10+
11+
it('should display welcome message', () => {
12+
page.navigateTo();
13+
expect(page.getTitleText()).toEqual('integration-project app is running!');
14+
});
15+
16+
afterEach(async () => {
17+
// Assert that there are no errors emitted from the browser
18+
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19+
expect(logs).not.toContain(jasmine.objectContaining({
20+
level: logging.Level.SEVERE,
21+
} as logging.Entry));
22+
});
23+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class AppPage {
4+
navigateTo(): Promise<unknown> {
5+
return browser.get(browser.baseUrl) as Promise<unknown>;
6+
}
7+
8+
getTitleText(): Promise<string> {
9+
return element(by.css('app-root .content span')).getText() as Promise<string>;
10+
}
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/e2e",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"types": [
8+
"jasmine",
9+
"jasminewd2",
10+
"node"
11+
]
12+
}
13+
}

0 commit comments

Comments
 (0)