Skip to content

Commit 7284e3d

Browse files
christopherthielenmergify[bot]
authored andcommitted
chore(ng13): update tests for typescript and angular versions
1 parent 2c2d1c0 commit 7284e3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1372
-13
lines changed

downstream_projects.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"packageDir": "./dist",
33
"projects": {
4-
"angular10": "./test-angular-versions/v10",
5-
"angular11": "./test-angular-versions/v11",
6-
"typescript3.6": "./test-typescript-versions/typescript3.6",
7-
"typescript3.7": "./test-typescript-versions/typescript3.7",
8-
"typescript3.8": "./test-typescript-versions/typescript3.8",
9-
"typescript3.9": "./test-typescript-versions/typescript3.9",
10-
"typescript4.0": "./test-typescript-versions/typescript4.0",
4+
"angular12": "./test-angular-versions/v12",
5+
"angular13": "./test-angular-versions/v13",
6+
"typescript37": "./test-typescript-versions/typescript3.7",
7+
"typescript38": "./test-typescript-versions/typescript3.8",
8+
"typescript39": "./test-typescript-versions/typescript3.9",
9+
"typescript40": "./test-typescript-versions/typescript4.0",
10+
"typescript41": "./test-typescript-versions/typescript4.1",
11+
"typescript42": "./test-typescript-versions/typescript4.2",
12+
"typescript43": "./test-typescript-versions/typescript4.3",
1113
"sample-app-angular": "https://github.com/ui-router/sample-app-angular.git"
1214
}
1315
}

test-angular-versions/v12/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# V12
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.13.
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.
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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"cli": {
5+
"packageManager": "yarn"
6+
},
7+
"newProjectRoot": "projects",
8+
"projects": {
9+
"v12": {
10+
"projectType": "application",
11+
"schematics": {
12+
"@schematics/angular:class": {
13+
"skipTests": true
14+
},
15+
"@schematics/angular:component": {
16+
"skipTests": true
17+
},
18+
"@schematics/angular:directive": {
19+
"skipTests": true
20+
},
21+
"@schematics/angular:guard": {
22+
"skipTests": true
23+
},
24+
"@schematics/angular:interceptor": {
25+
"skipTests": true
26+
},
27+
"@schematics/angular:pipe": {
28+
"skipTests": true
29+
},
30+
"@schematics/angular:service": {
31+
"skipTests": true
32+
},
33+
"@schematics/angular:application": {
34+
"strict": true
35+
}
36+
},
37+
"root": "",
38+
"sourceRoot": "src",
39+
"prefix": "app",
40+
"architect": {
41+
"build": {
42+
"builder": "@angular-devkit/build-angular:browser",
43+
"options": {
44+
"outputPath": "dist/v12",
45+
"index": "src/index.html",
46+
"main": "src/main.ts",
47+
"polyfills": "src/polyfills.ts",
48+
"tsConfig": "tsconfig.app.json",
49+
"assets": [
50+
"src/favicon.ico",
51+
"src/assets"
52+
],
53+
"styles": [
54+
"src/styles.css"
55+
],
56+
"scripts": []
57+
},
58+
"configurations": {
59+
"production": {
60+
"budgets": [
61+
{
62+
"type": "initial",
63+
"maximumWarning": "500kb",
64+
"maximumError": "1mb"
65+
},
66+
{
67+
"type": "anyComponentStyle",
68+
"maximumWarning": "2kb",
69+
"maximumError": "4kb"
70+
}
71+
],
72+
"fileReplacements": [
73+
{
74+
"replace": "src/environments/environment.ts",
75+
"with": "src/environments/environment.prod.ts"
76+
}
77+
],
78+
"outputHashing": "all"
79+
},
80+
"development": {
81+
"buildOptimizer": false,
82+
"optimization": false,
83+
"vendorChunk": true,
84+
"extractLicenses": false,
85+
"sourceMap": true,
86+
"namedChunks": true
87+
}
88+
},
89+
"defaultConfiguration": "production"
90+
},
91+
"serve": {
92+
"builder": "@angular-devkit/build-angular:dev-server",
93+
"configurations": {
94+
"production": {
95+
"browserTarget": "v12:build:production"
96+
},
97+
"development": {
98+
"browserTarget": "v12:build:development"
99+
}
100+
},
101+
"defaultConfiguration": "development"
102+
},
103+
"extract-i18n": {
104+
"builder": "@angular-devkit/build-angular:extract-i18n",
105+
"options": {
106+
"browserTarget": "v12:build"
107+
}
108+
},
109+
"test": {
110+
"builder": "@angular-devkit/build-angular:karma",
111+
"options": {
112+
"main": "src/test.ts",
113+
"polyfills": "src/polyfills.ts",
114+
"tsConfig": "tsconfig.spec.json",
115+
"karmaConfig": "karma.conf.js",
116+
"assets": [
117+
"src/favicon.ico",
118+
"src/assets"
119+
],
120+
"styles": [
121+
"src/styles.css"
122+
],
123+
"scripts": []
124+
}
125+
}
126+
}
127+
}
128+
},
129+
"defaultProject": "v12"
130+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"baseUrl": "http://localhost:4000",
3+
"video": false
4+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
describe('Angular app', () => {
2+
beforeEach(() => {
3+
window.sessionStorage.clear();
4+
});
5+
6+
it('loads', () => {
7+
cy.visit('');
8+
});
9+
10+
it('loads home state by default', () => {
11+
cy.visit('');
12+
cy.url().should('include', '/home');
13+
});
14+
15+
it('renders uisref as links', () => {
16+
cy.visit('');
17+
cy.get('a').contains('home');
18+
cy.get('a').contains('about');
19+
cy.get('a').contains('lazy');
20+
cy.get('a').contains('lazy.child');
21+
cy.get('a').contains('lazy.child.viewtarget');
22+
});
23+
24+
it('renders home', () => {
25+
cy.visit('/home');
26+
cy.get('a').contains('home').should('have.class', 'active');
27+
cy.get('a').contains('about').should('not.have.class', 'active');
28+
cy.get('#default').contains('home works');
29+
});
30+
31+
it('renders about', () => {
32+
cy.visit('/home');
33+
cy.visit('/about');
34+
cy.get('a').contains('home').should('not.have.class', 'active');
35+
cy.get('a').contains('about').should('have.class', 'active');
36+
cy.get('#default').contains('about works');
37+
});
38+
39+
it('loads lazy routes', () => {
40+
cy.visit('/home');
41+
cy.visit('/lazy');
42+
cy.get('a').contains('home').should('not.have.class', 'active');
43+
cy.get('a').contains('lazy').should('have.class', 'active');
44+
cy.get('#default').contains('lazy works');
45+
});
46+
47+
it('routes to lazy routes', () => {
48+
cy.visit('/lazy');
49+
cy.get('a').contains('home').should('not.have.class', 'active');
50+
cy.get('a').contains('lazy').should('have.class', 'active');
51+
cy.get('#default').contains('lazy works');
52+
});
53+
54+
it('routes to lazy child routes', () => {
55+
cy.visit('/lazy/child');
56+
cy.get('a').contains('home').should('not.have.class', 'active');
57+
cy.get('a').contains('lazy.child').should('have.class', 'active');
58+
cy.get('#default').contains('lazy.child works');
59+
});
60+
61+
it('targets named views', () => {
62+
cy.visit('/lazy/child/viewtarget');
63+
cy.get('a').contains('home').should('not.have.class', 'active');
64+
cy.get('a').contains('lazy.child').should('have.class', 'active');
65+
cy.get('#default').contains('lazy.child works');
66+
cy.get('#header').contains('lazy.child.viewtarget works');
67+
cy.get('#footer').contains('lazy.child.viewtarget works');
68+
});
69+
});
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, './coverage/v12'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' }
33+
]
34+
},
35+
reporters: ['progress', 'kjhtml'],
36+
port: 9876,
37+
colors: true,
38+
logLevel: config.LOG_INFO,
39+
autoWatch: true,
40+
browsers: ['Chrome'],
41+
singleRun: false,
42+
restartOnFileChange: true
43+
});
44+
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "12",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "npm run test:dev && npm run test:prod",
10+
"test:dev": "ng build --configuration development && cypress-runner run --path dist/v12",
11+
"test:prod": "ng build --configuration production && cypress-runner run --path dist/v12"
12+
},
13+
"private": true,
14+
"dependencies": {
15+
"@angular/animations": "~12.2.0",
16+
"@angular/common": "~12.2.0",
17+
"@angular/compiler": "~12.2.0",
18+
"@angular/core": "~12.2.0",
19+
"@angular/forms": "~12.2.0",
20+
"@angular/platform-browser": "~12.2.0",
21+
"@angular/platform-browser-dynamic": "~12.2.0",
22+
"@angular/router": "~12.2.0",
23+
"rxjs": "~6.6.0",
24+
"tslib": "^2.3.0",
25+
"zone.js": "~0.11.4",
26+
"@uirouter/angular": "*",
27+
"@uirouter/cypress-runner": "*"
28+
},
29+
"devDependencies": {
30+
"@angular-devkit/build-angular": "~12.2.13",
31+
"@angular/cli": "~12.2.13",
32+
"@angular/compiler-cli": "~12.2.0",
33+
"@types/jasmine": "~3.8.0",
34+
"@types/node": "^12.11.1",
35+
"jasmine-core": "~3.8.0",
36+
"karma": "~6.3.0",
37+
"karma-chrome-launcher": "~3.1.0",
38+
"karma-coverage": "~2.0.3",
39+
"karma-jasmine": "~4.0.0",
40+
"karma-jasmine-html-reporter": "~1.7.0",
41+
"typescript": "~4.3.5"
42+
}
43+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-about',
5+
template: ` <p>about works!</p> `,
6+
})
7+
export class AboutComponent {}

test-angular-versions/v12/src/app/app.component.css

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--The content below is only a placeholder and can be replaced.-->
2+
<div style="text-align: center">
3+
<h1>Welcome to {{ title }}!</h1>
4+
<img
5+
width="300"
6+
alt="Angular Logo"
7+
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
8+
/>
9+
</div>
10+
<h2>Here are some links to help you start:</h2>
11+
<ul>
12+
<li>
13+
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
14+
</li>
15+
<li>
16+
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
17+
</li>
18+
<li>
19+
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
20+
</li>
21+
</ul>

0 commit comments

Comments
 (0)