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

Why do we need to wrap tests in main() function? #65

Closed
masimplo opened this issue Mar 28, 2016 · 4 comments
Closed

Why do we need to wrap tests in main() function? #65

masimplo opened this issue Mar 28, 2016 · 4 comments
Labels

Comments

@masimplo
Copy link

Hi and thanks for the great guide.

Not really an issue as much as a question. Is there a particular reason why we need to wrap tests in main() function?

test-main.js

        if (module.hasOwnProperty('main')) {
          module.main();
        } else {
          console.log('MODULE: ' + path);
          throw new Error('Module ' + path + ' does not implement main() method.');
        }

It just feels weird.

@lathonez
Copy link
Owner

Hey,

Apologies in the delay getting back to you, I'm travelling atm.

This project is basically a fork of Angular 2 Seed

I had always assumed this came from Karma, but I cant find a reference to it anywhere other than Angular 2 Seed. After a solid half hour of googling I can't figure it out.

Have asked in gitter hopefully someone will get back to me.

Cheers,

@lathonez
Copy link
Owner

The maintainer @mgechev got back to me:

@lathonez it comes from the angular's test-main.js https://github.com/angular/angular/blob/master/test-main.js#L32-L40

The logic (invoking main) is in the very first commit.

I appreciate I haven't really answered your question. I guess you'll need to raise an issue against angular (or maybe you can figure it out from the history, I can't).

I try to keep this project in line with Angular 2 Seed as much as possible as that project is very heavily maintained and it makes my life easier porting new features over.

If you get an answer let me know.

@lathonez
Copy link
Owner

Hey

As per #68 getting merged back (440ac08), we no longer need a main method.

Cheers

@lathonez
Copy link
Owner

#191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants