Skip to content

Commit ee381da

Browse files
JiaLiPassionalxhub
authored andcommitted
test(zone.js): add integration test for zone.js Mocha patch (#45047)
Add integration test for `Mocha` patch from `zone.js` to verify the issue #42384 is fixed PR Close #45047
1 parent 8efbdb5 commit ee381da

31 files changed

Lines changed: 9811 additions & 0 deletions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See https://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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
load("//integration:index.bzl", "ng_integration_test")
2+
3+
ng_integration_test(
4+
name = "test",
5+
setup_chromium = True,
6+
track_payload_size = "cli-hello-world",
7+
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# CliHelloWorld
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.0-next.9.
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](https://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).
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"cli-hello-world": {
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",
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+
"progress": false
31+
},
32+
"configurations": {
33+
"production": {
34+
"fileReplacements": [
35+
{
36+
"replace": "src/environments/environment.ts",
37+
"with": "src/environments/environment.prod.ts"
38+
}
39+
],
40+
"optimization": true,
41+
"outputHashing": "all",
42+
"sourceMap": false,
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": "cli-hello-world:build"
66+
},
67+
"configurations": {
68+
"dev": {
69+
"browserTarget": "cli-hello-world:build:dev"
70+
},
71+
"production": {
72+
"browserTarget": "cli-hello-world:build:production"
73+
},
74+
"ci": {
75+
},
76+
"ci-production": {
77+
"browserTarget": "cli-hello-world:build:production",
78+
}
79+
}
80+
},
81+
"extract-i18n": {
82+
"builder": "@angular-devkit/build-angular:extract-i18n",
83+
"options": {
84+
"browserTarget": "cli-hello-world:build"
85+
}
86+
},
87+
"test": {
88+
"builder": "@angular-devkit/build-angular:karma",
89+
"options": {
90+
"main": "src/test.ts",
91+
"polyfills": "src/polyfills.ts",
92+
"tsConfig": "tsconfig.spec.json",
93+
"karmaConfig": "karma.conf.js",
94+
"assets": [
95+
"src/favicon.ico",
96+
"src/assets"
97+
],
98+
"styles": [
99+
"src/styles.css"
100+
],
101+
"scripts": [],
102+
"progress": false,
103+
"watch": false
104+
}
105+
},
106+
"lint": {
107+
"builder": "@angular-devkit/build-angular:tslint",
108+
"options": {
109+
"tsConfig": [
110+
"tsconfig.app.json",
111+
"tsconfig.spec.json",
112+
"e2e/tsconfig.json"
113+
],
114+
"exclude": [
115+
"**/node_modules/**"
116+
]
117+
}
118+
},
119+
"e2e": {
120+
"builder": "@angular-devkit/build-angular:protractor",
121+
"options": {
122+
"protractorConfig": "e2e/protractor.conf.js",
123+
"devServerTarget": "cli-hello-world:serve",
124+
"webdriverUpdate": false
125+
},
126+
"configurations": {
127+
"production": {
128+
"devServerTarget": "cli-hello-world:serve:production"
129+
},
130+
"ci": {
131+
"devServerTarget": "cli-hello-world:serve:ci"
132+
},
133+
"ci-production": {
134+
"devServerTarget": "cli-hello-world:serve:ci-production"
135+
}
136+
}
137+
}
138+
}
139+
}},
140+
"defaultProject": "cli-hello-world"
141+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// @ts-check
2+
// Protractor configuration file, see link for more information
3+
// https://github.com/angular/protractor/blob/master/lib/config.ts
4+
const { SpecReporter } = require('jasmine-spec-reporter');
5+
6+
/**
7+
* @type { import("protractor").Config }
8+
*/
9+
exports.config = {
10+
allScriptsTimeout: 11000,
11+
specs: [
12+
'./src/**/*.e2e-spec.ts'
13+
],
14+
chromeDriver: process.env.CHROMEDRIVER_BIN,
15+
capabilities: {
16+
browserName: 'chrome',
17+
chromeOptions: {
18+
binary: process.env.CHROME_BIN,
19+
// See /integration/README.md#browser-tests for more info on these args
20+
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
21+
},
22+
},
23+
directConnect: true,
24+
baseUrl: 'http://localhost:4200/',
25+
framework: 'jasmine',
26+
jasmineNodeOpts: {
27+
showColors: true,
28+
defaultTimeoutInterval: 30000,
29+
print: function() {}
30+
},
31+
onPrepare() {
32+
require('ts-node').register({
33+
project: require('path').join(__dirname, './tsconfig.json')
34+
});
35+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
36+
}
37+
};
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('cli-hello-world 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('cli-hello-world 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() {
5+
return browser.get(browser.baseUrl) as Promise<any>;
6+
}
7+
8+
getTitleText() {
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)