Skip to content

fix(tests): link package in e2e tests #198

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 13, 2016

Conversation

filipesilva
Copy link
Contributor

Close #194

This issue proved to be harder to fix than it initially looked like.

Running npm link did not seem to work, due to npm itself being local as per the npm link npm command in .travis.yml.

Removing npm link npm caused the tests to file in a spectacular fashion.

npm4 builds fail because ng install tests report a missing package - npm itself. This seems to have been what originated the inclusion of npm link npm in .travis.yml. Also related, #185 (comment).

npm5 builds fail in a much more confusing way.

Linking angular-cli shows a couple of warnings about npm packages that aren't part of angular-cli nor are present in npm4 builds:

npm WARN prefer global [email protected] should be installed with -g
npm WARN prefer global [email protected] should be installed with -g

There is also a weird stray error during the ng new test, that seems to be responsible for for ng new failing:

Error: ENOENT: no such file or directory, open '/home/travis/build/angular/angular-cli/tmp/foo/package.json'
    at Error (native)

The e2e build tests fail with missing core packages that should have been installed in in the initial ng new test-project (that seems to fail):

  app.ts (1, 25): Cannot find module 'angular2/platform/browser'.
  app.ts (3, 32): Cannot find module 'angular2/router'.
  app/test-project.spec.ts (1, 65): Cannot find module 'angular2/testing'.
  app/test-project.ts (1, 25): Cannot find module 'angular2/core'.
  app/test-project.ts (2, 46): Cannot find module 'angular2/router'.

I tried removing the acceptance tests for ng install and ng uninstall and the resulting build seems to pass every test, correctly linking the existing angular-cli and succeding and bulding the generated project, typings included.

This seems to indicate that either the ng install and ng uninstall acceptance tests or the commands themselves break subsequent tests.

I found two references to the instability of using the npm module programatically: one on stack overflow and one on ember-cli.

This prompted me to change the ng install and ng uninstall code to use shelljs to run npm install/uninstall commands instead using npm programatically as before. That seems to have fixed the weird interactions between their acceptance tests and the e2e tests.

/cc @hansl @jkuri @Brocco

@filipesilva filipesilva force-pushed the e2e-link-package branch 12 times, most recently from 7eabffb to d878407 Compare February 13, 2016 03:48
@filipesilva filipesilva changed the title fix(tests): link package in e2e tests [WIP] fix(tests): link package in e2e tests Feb 13, 2016
@filipesilva filipesilva force-pushed the e2e-link-package branch 15 times, most recently from 164f058 to 227ab3c Compare February 13, 2016 15:38
@filipesilva filipesilva changed the title [WIP] fix(tests): link package in e2e tests fix(tests): link package in e2e tests Feb 13, 2016
@Brocco
Copy link
Contributor

Brocco commented Feb 13, 2016

lgtm

}
var npmCommand = 'npm install ' + this.packages.join(' ') + this.npmOptions;

return new Promise(function (resolve, reject){
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pattern that we will do a lot and I'd like to avoid the copy and paste. Could you move the sh.exec and promise into a helper function that would be imported everywhere?

@filipesilva filipesilva merged commit 94c9746 into angular:master Feb 13, 2016
@filipesilva filipesilva deleted the e2e-link-package branch June 13, 2016 16:12
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

e2e workflow spec should use a linked angular cli
3 participants