|
1 |
| -import {readFile, writeFile} from './fs'; |
2 |
| -import {silentExecAndWaitForOutputToMatch, silentNpm, ng} from './process'; |
3 |
| -import {getGlobalVariable} from './env'; |
| 1 | +import { readFile, writeFile, replaceInFile } from './fs'; |
| 2 | +import { silentExecAndWaitForOutputToMatch, silentNpm, ng } from './process'; |
| 3 | +import { getGlobalVariable } from './env'; |
4 | 4 |
|
5 | 5 | const packages = require('../../../lib/packages').packages;
|
6 | 6 |
|
@@ -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,36 @@ 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 | + // Not a problem if the file can't be found. |
| 98 | + .catch(() => null) |
| 99 | + .then(() => replaceInFile('karma.conf.js', `browsers: ['Chrome'],`, |
| 100 | + `browsers: ['ChromeCI'], |
| 101 | + customLaunchers: { |
| 102 | + ChromeCI: { |
| 103 | + base: '${process.env['TRAVIS'] ? 'ChromeHeadless' : 'Chrome'}', |
| 104 | + flags: ['--no-sandbox'] |
| 105 | + } |
| 106 | + }, |
| 107 | + `)) |
| 108 | + .catch(() => null); |
| 109 | +} |
| 110 | + |
80 | 111 | // Convert a Angular 4 project to Angular 2.
|
81 | 112 | export function useNg2() {
|
82 | 113 | const ng2Deps: any = {
|
|
0 commit comments