Skip to content

Commit

Permalink
fix(eject): set ejected project to run webdriver-manager update as …
Browse files Browse the repository at this point in the history
…part of `e2e` npm script

Closes #4920
  • Loading branch information
Meligy authored and hansl committed Feb 22, 2017
1 parent fd1296a commit 7567f5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@angular/cli/tasks/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const E2eTask = Task.extend({
const webdriverUpdate = requireProjectModule(projectRoot,
'protractor/node_modules/webdriver-manager/built/lib/cmds/update');
// run `webdriver-manager update --standalone false --gecko false --quiet`
// if you change this, update the command comment in prev line, and in `eject` task
promise = promise.then(() => webdriverUpdate.program.run({
standalone: false,
gecko: false,
Expand Down
9 changes: 9 additions & 0 deletions packages/@angular/cli/tasks/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const ProgressPlugin = require('webpack/lib/ProgressPlugin');
export const pluginArgs = Symbol('plugin-args');
export const postcssArgs = Symbol('postcss-args');

const pree2eNpmScript = `webdriver-manager update --standalone false --gecko false --quiet`;


class JsonWebpackSerializer {
public imports: {[name: string]: string[]} = {};
Expand Down Expand Up @@ -434,6 +436,12 @@ export default Task.extend({
Your package.json scripts needs to not contain a start script as it will be overwritten.
`);
}
if (scripts['pree2e'] && scripts['pree2e'] !== pree2eNpmScript && !force) {
throw new SilentError(oneLine`
Your package.json scripts needs to not contain a pree2e script as it will be
overwritten.
`);
}
if (scripts['e2e'] && scripts['e2e'] !== 'ng e2e' && !force) {
throw new SilentError(oneLine`
Your package.json scripts needs to not contain a e2e script as it will be overwritten.
Expand All @@ -448,6 +456,7 @@ export default Task.extend({
packageJson['scripts']['build'] = 'webpack';
packageJson['scripts']['start'] = 'webpack-dev-server';
packageJson['scripts']['test'] = 'karma start ./karma.conf.js';
packageJson['scripts']['pree2e'] = pree2eNpmScript;
packageJson['scripts']['e2e'] = 'protractor ./protractor.conf.js';

// Add new dependencies based on our dependencies.
Expand Down

0 comments on commit 7567f5c

Please sign in to comment.