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

Angular 7 update #5

Merged
merged 2 commits into from
Feb 17, 2019
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
60 changes: 0 additions & 60 deletions .angular-cli.json

This file was deleted.

2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true

[*]
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

# compiled output
/dist
/dist-server
/tmp
/out-tsc

# dependencies
/node_modules

# profiling files
chrome-profiler-events.json
speed-measure-plugin.json

# IDEs and editors
/.idea
.project
Expand All @@ -31,13 +34,10 @@
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
Expand Down
135 changes: 135 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular-cypress-unit": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular-cypress-unit",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-cypress-unit:build"
},
"configurations": {
"production": {
"browserTarget": "angular-cypress-unit:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-cypress-unit:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"angular-cypress-unit-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular-cypress-unit:serve"
},
"configurations": {
"production": {
"devServerTarget": "angular-cypress-unit:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "angular-cypress-unit"
}
37 changes: 37 additions & 0 deletions cypress/integration/spec-private-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ɵrenderComponent as renderComponent, ɵcompileComponent as compileComponent} from '@angular/core';
import '@angular/compiler';
import 'zone.js';
import { AppComponent } from '../../src/app/app.component';

/* eslint-env mocha */
/* global cy */
describe('AppComponent', () => {
beforeEach(() => {
const html = `
<head>
<meta charset="UTF-8">
</head>
<body>
<app-root></app-root>
</body>
`;
const document = (cy as any).state('document');
document.write(html);
document.close();

// Quick hack to get the component definition, which in our case is the first annotation.
compileComponent(AppComponent, (<any>AppComponent).__annotations__[0]);
renderComponent(AppComponent, {
host: document.body
});
});

it('works', () => {
cy.contains('Welcome to angular-cypress-unit!').should('be.visible');
});

it('works again', () => {
cy.contains('Welcome to angular-cypress-unit!').should('be.visible');
});

});
6 changes: 4 additions & 2 deletions cypress/integration/spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// <reference types="cypress" />

// Required for JIT in NG-7
import 'core-js/es7/reflect';
import { ApplicationRef, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
Expand Down Expand Up @@ -52,10 +54,10 @@ describe('AppComponent', () => {
});

it('works', () => {
cy.contains('Welcome to app').should('be.visible');
cy.contains('Welcome to angular-cypress-unit').should('be.visible');
});

it('works again', () => {
cy.contains('Welcome to app').should('be.visible');
cy.contains('Welcome to angular-cypress-unit').should('be.visible');
});
});
6 changes: 3 additions & 3 deletions cypress/plugins/cy-ts-preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ const webpackOptions = {
loaders: ['ts-loader', 'angular2-template-loader'],
exclude: [/node_modules/],
},
{
test: /\.(html|css)$/,
{
test: /\.(html|css)$/,
loader: 'raw-loader',
exclude: /\.async\.(html|css)$/
},
{
test: /\.async\.(html|css)$/,
test: /\.async\.(html|css)$/,
loaders: ['file?name=[name].[hash].[ext]', 'extract']
}
]
Expand Down
1 change: 1 addition & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"../node_modules/cypress"
],
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true
}
Expand Down
6 changes: 3 additions & 3 deletions protractor.conf.js → e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
Expand All @@ -21,8 +21,8 @@ exports.config = {
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
};
4 changes: 2 additions & 2 deletions e2e/app.e2e-spec.ts → e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppPage } from './app.po';

describe('ng-mount App', () => {
describe('workspace-project App', () => {
let page: AppPage;

beforeEach(() => {
Expand All @@ -9,6 +9,6 @@ describe('ng-mount App', () => {

it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
expect(page.getTitleText()).toEqual('Welcome to angular-cypress-unit!');
});
});
2 changes: 1 addition & 1 deletion e2e/app.po.ts → e2e/src/app.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class AppPage {
return browser.get('/');
}

getParagraphText() {
getTitleText() {
return element(by.css('app-root h1')).getText();
}
}
5 changes: 2 additions & 3 deletions e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
Expand All @@ -11,4 +10,4 @@
"node"
]
}
}
}
Loading