Skip to content

chore: implicityAny by default and update blueprints #111

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

Closed
wants to merge 2 commits into from
Closed
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
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,33 @@ ng build
The build artifacts will be stored in the `dist/` directory.


### Running tests
### Running unit tests

Before running the tests make sure that the project is built. To build the
Before running the tests make sure that the project is built. To build the
project once you can use:

```bash
ng build
```

With the project built in the `dist/` folder you can just run: `karma start`.
With the project built in the `dist/` folder you can just run: `karma start`.
Karma will run the tests and keep the browser open waiting to run again.

This will be easier when the command

### Running end-to-end tests

Before running the tests make sure that you have an updated webdriver and that
the tests are built:

```bash
$(npm bin)/webdriver-manager update
$(npm bin)/tsc -p e2e/
```

Afterwards you only need to run `$(npm bin)/protractor` while serving via
`ng serve`.

This will be easier when the command
[ng test](https://github.com/angular/angular-cli/issues/70) is implemented.


Expand Down
15 changes: 15 additions & 0 deletions addon/ng2/blueprints/ng2/files/e2e/app.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "angular2/testing";
import { <%= jsComponentName %>Page } from './app.po';

describe('<%= htmlComponentName %> App', function() {
let page: <%= jsComponentName %>Page;

beforeEach(() => {
page = new <%= jsComponentName %>Page();
})

it('should display message saying app works', () => {
page.navigateTo()
expect(page.getParagraphText()).toEqual('<%= htmlComponentName %> Works!');
});
});
6 changes: 6 additions & 0 deletions addon/ng2/blueprints/ng2/files/e2e/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "angular2/testing";

export class <%= jsComponentName %>Page {
navigateTo() { return browser.get('/'); }
getParagraphText() { return element(by.css('<%= jsComponentName %>-app p')).getText(); }
}
11 changes: 11 additions & 0 deletions addon/ng2/blueprints/ng2/files/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false
}
}
6 changes: 5 additions & 1 deletion addon/ng2/blueprints/ng2/files/gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
testem.log

# e2e
/e2e/*.js
/e2e/*.map
4 changes: 3 additions & 1 deletion addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"jasmine-core": "^2.3.4",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.1",
"karma-jasmine": "^0.3.6"
"karma-jasmine": "^0.3.6",
"protractor": "^3.0.0",
"typescript": "^1.7.3"
}
}
28 changes: 28 additions & 0 deletions addon/ng2/blueprints/ng2/files/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
exports.config = {
allScriptsTimeout: 11000,

specs: [
'e2e/**/*.e2e.js'
],

capabilities: {
'browserName': 'chrome'
},

directConnect: true,

baseUrl: 'http://localhost:4200/',

framework: 'jasmine',

jasmineNodeOpts: {
defaultTimeoutInterval: 30000
},

useAllAngular2AppRoots: true,

beforeLaunch: function() {
require('zone.js');
require('reflect-metadata');
}
};
4 changes: 2 additions & 2 deletions addon/ng2/blueprints/ng2/files/src/app/__name__.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {<%= jsComponentName %>App} from '../app/<%= htmlComponentName %>';
beforeEachProviders(() => [<%= jsComponentName %>App]);

describe('App: <%= jsComponentName %>', () => {
it('should have the `defaultMeaning` as 42', inject([<%= jsComponentName %>App], (app) => {
it('should have the `defaultMeaning` as 42', inject([<%= jsComponentName %>App], (app: <%= jsComponentName %>App) => {
expect(app.defaultMeaning).toBe(42);
}));

describe('#meaningOfLife', () => {
it('should get the meaning of life', inject([<%= jsComponentName %>App], (app) => {
it('should get the meaning of life', inject([<%= jsComponentName %>App], (app: <%= jsComponentName %>App) => {
expect(app.meaningOfLife()).toBe('The meaning of life is 42');
expect(app.meaningOfLife(22)).toBe('The meaning of life is 22');
}));
Expand Down
2 changes: 1 addition & 1 deletion addon/ng2/blueprints/ng2/files/src/app/__name__.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {Component} from 'angular2/core';
export class <%= jsComponentName %>App {
defaultMeaning: number = 42;

meaningOfLife(meaning) {
meaningOfLife(meaning?: number) {
return `The meaning of life is ${meaning || this.defaultMeaning}`;
}
}