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

fix(eject): set ejected project to run webdriver-manager update as part of e2e npm script #4920

Closed
wants to merge 1 commit into from
Closed
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
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
10 changes: 10 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,13 @@ 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) {
// tslint:disable-next-line:max-line-length
Copy link
Contributor

Choose a reason for hiding this comment

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

You're using oneLine so you can put your string in multiple lines and they'll be joined. Remove this tslint exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixing myself then committing.

throw new SilentError(oneLine`
Your package.json scripts needs to not contain a pree2e script as it will be overwritten.
`);
// tslint:enable-next-line:max-line-length
}
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 +457,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