Skip to content

Commit 033b520

Browse files
clydindgp1130
authored andcommitted
fix(@angular-devkit/build-angular): resolve webdriver-manager from protractor location
The webdriver-manager package is a direct dependency of protractor. The only guaranteed method to resolve the webdriver-manager package in this case is to resolve it from a base of the protractor location. (cherry picked from commit 3595cee)
1 parent c139587 commit 033b520

File tree

1 file changed

+7
-13
lines changed
  • packages/angular_devkit/build_angular/src/protractor

1 file changed

+7
-13
lines changed

packages/angular_devkit/build_angular/src/protractor/index.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,15 @@ function runProtractor(root: string, options: ProtractorBuilderOptions): Promise
3939
async function updateWebdriver() {
4040
// The webdriver-manager update command can only be accessed via a deep import.
4141
const webdriverDeepImport = 'webdriver-manager/built/lib/cmds/update';
42-
const importOptions = [
43-
// When using npm, webdriver is within protractor/node_modules.
44-
`protractor/node_modules/${webdriverDeepImport}`,
45-
// When using yarn, webdriver is found as a root module.
46-
webdriverDeepImport,
47-
];
4842

4943
let path;
50-
for (const importOption of importOptions) {
51-
try {
52-
path = require.resolve(importOption);
53-
} catch (error) {
54-
if (error.code !== 'MODULE_NOT_FOUND') {
55-
throw error;
56-
}
44+
try {
45+
const protractorPath = require.resolve('protractor');
46+
47+
path = require.resolve(webdriverDeepImport, { paths: [protractorPath] });
48+
} catch (error) {
49+
if (error.code !== 'MODULE_NOT_FOUND') {
50+
throw error;
5751
}
5852
}
5953

0 commit comments

Comments
 (0)