Skip to content

Commit 7567f5c

Browse files
Meligyhansl
authored andcommitted
fix(eject): set ejected project to run webdriver-manager update as part of e2e npm script
Closes #4920
1 parent fd1296a commit 7567f5c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/@angular/cli/tasks/e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const E2eTask = Task.extend({
4343
const webdriverUpdate = requireProjectModule(projectRoot,
4444
'protractor/node_modules/webdriver-manager/built/lib/cmds/update');
4545
// run `webdriver-manager update --standalone false --gecko false --quiet`
46+
// if you change this, update the command comment in prev line, and in `eject` task
4647
promise = promise.then(() => webdriverUpdate.program.run({
4748
standalone: false,
4849
gecko: false,

packages/@angular/cli/tasks/eject.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const ProgressPlugin = require('webpack/lib/ProgressPlugin');
3131
export const pluginArgs = Symbol('plugin-args');
3232
export const postcssArgs = Symbol('postcss-args');
3333

34+
const pree2eNpmScript = `webdriver-manager update --standalone false --gecko false --quiet`;
35+
3436

3537
class JsonWebpackSerializer {
3638
public imports: {[name: string]: string[]} = {};
@@ -434,6 +436,12 @@ export default Task.extend({
434436
Your package.json scripts needs to not contain a start script as it will be overwritten.
435437
`);
436438
}
439+
if (scripts['pree2e'] && scripts['pree2e'] !== pree2eNpmScript && !force) {
440+
throw new SilentError(oneLine`
441+
Your package.json scripts needs to not contain a pree2e script as it will be
442+
overwritten.
443+
`);
444+
}
437445
if (scripts['e2e'] && scripts['e2e'] !== 'ng e2e' && !force) {
438446
throw new SilentError(oneLine`
439447
Your package.json scripts needs to not contain a e2e script as it will be overwritten.
@@ -448,6 +456,7 @@ export default Task.extend({
448456
packageJson['scripts']['build'] = 'webpack';
449457
packageJson['scripts']['start'] = 'webpack-dev-server';
450458
packageJson['scripts']['test'] = 'karma start ./karma.conf.js';
459+
packageJson['scripts']['pree2e'] = pree2eNpmScript;
451460
packageJson['scripts']['e2e'] = 'protractor ./protractor.conf.js';
452461

453462
// Add new dependencies based on our dependencies.

0 commit comments

Comments
 (0)