Skip to content

fix(tests): add test to verify noImplicityAny builds work #213

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

Merged
merged 1 commit into from
Feb 17, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>';

describe('<%= classifiedModuleName %> Component', () => {

beforeEachProviders(() => []);
beforeEachProviders((): any[] => []);


it('should ...', injectAsync([TestComponentBuilder], (tcb:TestComponentBuilder) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>';

@Component({
selector: 'test-component',
template: `<div <%= dasherizedModuleName %></div>`
template: `<div <%= dasherizedModuleName %>></div>`
})
class TestComponent {}

describe('<%= classifiedModuleName %> Directive', () => {

beforeEachProviders(() => []);
beforeEachProviders((): any[] => []);


it('should ...', injectAsync([TestComponentBuilder], (tcb:TestComponentBuilder) => {
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 @@ -14,7 +14,7 @@ import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
])
export class <%= jsComponentName %>App {
defaultMeaning: number = 42;

meaningOfLife(meaning?: number) {
return `The meaning of life is ${meaning || this.defaultMeaning}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Pipe, PipeTransform} from 'angular2/core';
})
export class <%= classifiedModuleName %> implements PipeTransform {

transform(value, args?) {
transform(value: any, args?: any): any {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be args?: any[] ?

return null;
}

Expand Down
35 changes: 32 additions & 3 deletions tests/e2e/e2e_workflow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Basic end-to-end Workflow', function () {
'build',
'--silent'
]).then(function() {
expect(fs.existsSync(path.join(process.cwd(), 'dist')));
expect(fs.existsSync(path.join(process.cwd(), 'dist'))).to.be.equal(true);
});
});

Expand Down Expand Up @@ -174,8 +174,37 @@ describe('Basic end-to-end Workflow', function () {
expect(result.exitCode).to.be.equal(0);

// Clean `tmp` folder
process.chdir(path.resolve(root, '..'));
sh.rm('-rf', './tmp'); // tmp.teardown takes too long
// process.chdir(path.resolve(root, '..'));
// sh.rm('-rf', './tmp'); // tmp.teardown takes too long
});
});

it('Turn on `noImplicitAny` in tsconfig.json and rebuild', function (done) {
this.timeout(420000);

var configFilePath = path.join(process.cwd(), 'src', 'tsconfig.json');
fs.readFile(configFilePath, 'utf8', function(err, data){

var config = JSON.parse(data);
config.compilerOptions.noImplicitAny = true;

fs.writeFile(configFilePath, JSON.stringify(config), function(){
//clear the dist folder
sh.rm('-rf', path.join(process.cwd(), 'dist'));

return ng([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is return needed here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not needed. It was a result of copying in the promise implementation from above. But at the same time, right now that does not hurt anything. The next change I make in there, I'll clean that up, but I don't think it's worth a separate PR to remove it with no other changes.

'build',
'--silent'
]).then(function() {
expect(fs.existsSync(path.join(process.cwd(), 'dist'))).to.be.equal(true);
})
.finally(function(){
// Clean `tmp` folder
process.chdir(path.resolve(root, '..'));
sh.rm('-rf', './tmp'); // tmp.teardown takes too long
done();
});
});
});
});

Expand Down