|
1 |
| -import {readFile, writeFile} from './fs'; |
| 1 | +import {readFile, writeFile, replaceInFile} from './fs'; |
2 | 2 | import {execAndWaitForOutputToMatch, silentNpm, ng} from './process';
|
3 | 3 | import {getGlobalVariable} from './env';
|
4 | 4 |
|
@@ -43,6 +43,7 @@ export function createProject(name: string, ...args: string[]) {
|
43 | 43 | json['dependencies'][pkgName] = packages[pkgName].dist;
|
44 | 44 | });
|
45 | 45 | }))
|
| 46 | + .then(() => useCIChrome()) |
46 | 47 | .then(() => argv['ng2'] ? useNg2() : Promise.resolve())
|
47 | 48 | .then(() => {
|
48 | 49 | if (argv.nightly || argv['ng-sha']) {
|
@@ -77,6 +78,33 @@ export function createProject(name: string, ...args: string[]) {
|
77 | 78 | .then(() => silentNpm('install'));
|
78 | 79 | }
|
79 | 80 |
|
| 81 | +export function useCIChrome() { |
| 82 | + // There's a race condition happening in Chrome. Enabling logging in chrome used by |
| 83 | + // protractor actually fixes it. Logging is piped to a file so it doesn't affect our setup. |
| 84 | + // --no-sandbox is needed for Circle CI. |
| 85 | + // Travis can use headless chrome, but not appveyor. |
| 86 | + return Promise.resolve() |
| 87 | + .then(() => replaceInFile('protractor.conf.js', `'browserName': 'chrome'`, |
| 88 | + `'browserName': 'chrome', |
| 89 | + chromeOptions: { |
| 90 | + args: [ |
| 91 | + "--enable-logging", |
| 92 | + "--no-sandbox", |
| 93 | + ${process.env['TRAVIS'] ? '"--headless", "--disable-gpu"' : ''} |
| 94 | + ] |
| 95 | + } |
| 96 | + `)) |
| 97 | + .then(() => replaceInFile('karma.conf.js', `browsers: ['Chrome'],`, |
| 98 | + `browsers: ['ChromeCI'], |
| 99 | + customLaunchers: { |
| 100 | + ChromeCI: { |
| 101 | + base: '${process.env['TRAVIS'] ? 'ChromeHeadless' : 'Chrome'}', |
| 102 | + flags: ['--no-sandbox'] |
| 103 | + } |
| 104 | + }, |
| 105 | + `)); |
| 106 | +} |
| 107 | + |
80 | 108 | // Convert a Angular 4 project to Angular 2.
|
81 | 109 | export function useNg2() {
|
82 | 110 | const ng2Deps: any = {
|
|
0 commit comments