Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Angular 15 #1938

Merged
merged 1 commit into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2
job_defaults_var: &job_defaults
working_directory: ~/workspace/app
docker:
- image: circleci/node:14.16.1-browsers
- image: circleci/node:16.13.0-browsers

# Yarn cache key
cache_var: &cache_key yarn-packages-v2-{{ .Branch }}-{{ checksum "yarn.lock" }}
Expand Down Expand Up @@ -246,6 +246,18 @@ jobs:
paths:
- app/integrations/hello-world-ng14-ivy/dist-integration

integration_ng15_tests:
<<: *job_defaults
steps:
- *attach_workspace
- run:
name: Run integration tests for ng15 application
command: yarn integration:ng15
- persist_to_workspace:
root: ~/workspace
paths:
- app/integrations/hello-world-ng15/dist-integration

integration_test_types:
<<: *job_defaults
steps:
Expand Down Expand Up @@ -366,6 +378,10 @@ workflows:
requires:
- build

- integration_ng15_tests:
requires:
- build

- integration_test_types:
requires:
- build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
- 'integration:ng12:ivy'
- 'integration:ng13:ivy'
- 'integration:ng14:ivy'
- 'integration:ng15'
- 'test:types'

steps:
Expand Down Expand Up @@ -143,4 +144,4 @@ jobs:
run: yarn bundlemon
env:
BUNDLEMON_PROJECT_ID: 62b174ff6619780d8caf79fa
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
42 changes: 42 additions & 0 deletions integrations/hello-world-ng15/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
96 changes: 96 additions & 0 deletions integrations/hello-world-ng15/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"hello-world-ng15": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist-integration",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "hello-world-ng15:build:production"
},
"development": {
"browserTarget": "hello-world-ng15:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "hello-world-ng15:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions integrations/hello-world-ng15/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"baseUrl": "http://localhost:4200",
"video": false,
"responseTimeout": 60000,
"pageLoadTimeout": 120000,
"ignoreTestFiles": ["**/plugins/**.js", "**/tsconfig.json"]
}
5 changes: 5 additions & 0 deletions integrations/hello-world-ng15/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference types="cypress" />

import { IndexPo } from '../support/index.po';

describe('Index page', () => {
const index = new IndexPo();

beforeEach(() => index.navigateTo());

it('should render application using the latest version', () => {
// Arrange & act & assert
// Expect that the running applicaiton was compiled
// with the necessary Angular version!
cy.get('app-root')
.invoke('attr', 'ng-version')
.should('have.string', '15');
});

it('should click on the button and increase the counter', () => {
// Arrange & act & assert
cy.get('button')
.click()
.click()
.click()
.get('p')
.should('contain.text', 'Counter is 3');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
resolve: {
extensions: ['.js', '.ts']
},
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
]
}
]
}
};
8 changes: 8 additions & 0 deletions integrations/hello-world-ng15/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const webpack = require('@cypress/webpack-preprocessor');

const webpackOptions = require('./cypress-webpack.config');

module.exports = on => {
const options = { webpackOptions };
on('file:preprocessor', webpack(options));
};
7 changes: 7 additions & 0 deletions integrations/hello-world-ng15/cypress/support/base.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export abstract class BasePo {
abstract pageUrl: string;

navigateTo() {
cy.visit(this.pageUrl);
}
}
5 changes: 5 additions & 0 deletions integrations/hello-world-ng15/cypress/support/index.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { BasePo } from './base.po';

export class IndexPo extends BasePo {
pageUrl = '/';
}
10 changes: 10 additions & 0 deletions integrations/hello-world-ng15/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"typeRoots": ["../node_modules/@types"],
"lib": ["es2017", "dom"]
},
"include": ["integration/*.ts", "support/*.ts", "../node_modules/cypress"]
}
47 changes: 47 additions & 0 deletions integrations/hello-world-ng15/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = config => {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/ng15'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
restartOnFileChange: true
});
};
Loading