Skip to content

Commit 31abb81

Browse files
clydinalexeagle
authored andcommitted
test: remove all references to eject from CLI E2E tests
1 parent f58a7de commit 31abb81

22 files changed

+9
-114
lines changed

tests/legacy-cli/e2e/tests/basic/assets.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
import { ng } from '../../utils/process';
99
import { updateJsonFile } from '../../utils/project';
1010
import { expectToFail } from '../../utils/utils';
11-
import {getGlobalVariable} from '../../utils/env';
1211

1312

1413
// const temp = require('temp');
@@ -17,7 +16,6 @@ import {getGlobalVariable} from '../../utils/env';
1716
// tslint:disable:max-line-length
1817
export default function () {
1918
// Disable parts of it in webpack tests.
20-
const ejected = getGlobalVariable('argv').eject;
2119

2220
// TODO: update test
2321
return;
@@ -110,7 +108,7 @@ export default function () {
110108
// .gitkeep shouldn't be copied.
111109
.then(() => expectToFail(() => expectFileToExist('dist/assets/.gitkeep')))
112110
// Update app to test assets are present.
113-
.then(_ => !ejected && writeMultipleFiles({
111+
.then(_ => writeMultipleFiles({
114112
'src/app/app.module.ts': `
115113
import { BrowserModule } from '@angular/platform-browser';
116114
import { NgModule } from '@angular/core';
@@ -191,6 +189,6 @@ export default function () {
191189
});
192190
});`,
193191
}))
194-
.then(() => !ejected && ng('test', '--watch=false'))
195-
.then(() => !ejected && ng('e2e', 'test-project-e2e'));
192+
.then(() => ng('test', '--watch=false'))
193+
.then(() => ng('e2e', 'test-project-e2e'));
196194
}

tests/legacy-cli/e2e/tests/basic/rebuild.ts

-5
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,13 @@ import {
77
import {writeFile, writeMultipleFiles} from '../../utils/fs';
88
import {wait} from '../../utils/utils';
99
import {request} from '../../utils/http';
10-
import {getGlobalVariable} from '../../utils/env';
1110

1211
const validBundleRegEx = /: Compiled successfully./;
1312

1413
export default function() {
1514
if (process.platform.startsWith('win')) {
1615
return Promise.resolve();
1716
}
18-
// Skip this in ejected tests.
19-
if (getGlobalVariable('argv').eject) {
20-
return Promise.resolve();
21-
}
2217

2318
const lazyChunkRegExp = /lazy-module\.js/g;
2419

tests/legacy-cli/e2e/tests/build/build-app-shell-with-schematic.ts

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import { readNgVersion } from '../../utils/version';
77

88

99
export default function () {
10-
// Skip this in ejected tests.
11-
if (getGlobalVariable('argv').eject) {
12-
return Promise.resolve();
13-
}
14-
1510
// Skip this test in Angular 2/4.
1611
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
1712
return Promise.resolve();

tests/legacy-cli/e2e/tests/build/build-app-shell.ts

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ import { stripIndent } from 'common-tags';
88

99

1010
export default function () {
11-
// Skip this in ejected tests.
12-
if (getGlobalVariable('argv').eject) {
13-
return Promise.resolve();
14-
}
15-
1611
// Skip this test in Angular 2/4.
1712
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
1813
return Promise.resolve();

tests/legacy-cli/e2e/tests/build/build-errors.ts

-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ export default function () {
1919
return Promise.resolve();
2020
}
2121

22-
// Skip this in ejected tests.
23-
if (getGlobalVariable('argv').eject) {
24-
return Promise.resolve();
25-
}
26-
2722
// Skip this test in Angular 2/4.
2823
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
2924
return Promise.resolve();

tests/legacy-cli/e2e/tests/build/delete-output-path.ts

-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ import {getGlobalVariable} from '../../utils/env';
66
export default function() {
77
// TODO(architect): Delete this test. It is now in devkit/build-angular.
88

9-
// Skip this in ejected tests.
10-
if (getGlobalVariable('argv').eject) {
11-
return Promise.resolve();
12-
}
13-
149
return ng('build')
1510
// This is supposed to fail since there's a missing file
1611
.then(() => deleteFile('src/app/app.component.ts'))

tests/legacy-cli/e2e/tests/build/deploy-url.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export default function () {
2727
/__webpack_require__\.p = "deployUrl\/";/));
2828
// // verify slash is appended to the end of --deploy-url if missing
2929
// .then(() => ng('build', '--deploy-url=deployUrl', '--extract-css=false'))
30-
// // skip this in ejected tests
31-
// .then(() => getGlobalVariable('argv').eject
32-
// ? Promise.resolve()
33-
// : expectFileToMatch('dist/test-project/untime.js', /__webpack_require__\.p = "deployUrl\/";/));
30+
// .then(() =>
31+
// expectFileToMatch('dist/test-project/untime.js', /__webpack_require__\.p = "deployUrl\/";/));
3432
}

tests/legacy-cli/e2e/tests/build/eval-sourcemap.ts

-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
import {execAndWaitForOutputToMatch, killAllProcesses} from '../../utils/process';
2-
import {getGlobalVariable} from '../../utils/env';
32

43

54
export default function() {
65
// TODO(architect): Dev-server does not yet do this. Fix, reenable, validate, then delete this test.
76
return;
87

9-
// Skip this in ejected tests.
10-
if (getGlobalVariable('argv').eject) {
11-
return Promise.resolve();
12-
}
13-
148
return Promise.resolve()
159
// Check that ng serve has eval sourcemaps by default.
1610
.then(() => execAndWaitForOutputToMatch('ng', ['serve'], /: Compiled successfully/))

tests/legacy-cli/e2e/tests/build/json.ts

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import {getGlobalVariable} from '../../utils/env';
77
export default function() {
88
// TODO(architect): Delete this test. It is now in devkit/build-angular.
99

10-
// Skip this in ejected tests.
11-
if (getGlobalVariable('argv').eject) {
12-
return Promise.resolve();
13-
}
14-
1510
return ng('build', '--stats-json')
1611
.then(() => expectFileToExist('./dist/test-project/stats.json'))
1712
.then(() => expectGitToBeClean());

tests/legacy-cli/e2e/tests/build/output-dir.ts

-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ import {expectToFail} from '../../utils/utils';
99
export default function() {
1010
// TODO(architect): Delete this test. It is now in devkit/build-angular.
1111

12-
// Skip this in ejected tests.
13-
if (getGlobalVariable('argv').eject) {
14-
return Promise.resolve();
15-
}
16-
1712
return ng('build', '--output-path', 'build-output')
1813
.then(() => expectFileToExist('./build-output/index.html'))
1914
.then(() => expectFileToExist('./build-output/main.js'))

tests/legacy-cli/e2e/tests/build/platform-server.ts

-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import { readNgVersion } from '../../utils/version';
1414
import { expectToFail } from '../../utils/utils';
1515

1616
export default function () {
17-
// Skip this for ejected tests.
18-
if (getGlobalVariable('argv').eject) {
19-
return Promise.resolve();
20-
}
21-
2217
let platformServerVersion = readNgVersion();
2318
let httpVersion = readNgVersion();
2419

tests/legacy-cli/e2e/tests/build/prod-build.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import {getGlobalVariable} from '../../utils/env';
99
export default function() {
1010
// TODO(architect): Delete this test. It is now in devkit/build-angular.
1111

12-
// Skip this in ejected tests.
13-
const ejected = getGlobalVariable('argv').eject;
14-
1512
// Can't use the `ng` helper because somewhere the environment gets
1613
// stuck to the first build done
1714
return ng('build', '--prod')
@@ -26,5 +23,5 @@ export default function() {
2623
expectFileToMatch(`dist/test-project/${main}`, /bootstrapModuleFactory\(/);
2724
})
2825
// Check that the process didn't change local files.
29-
.then(() => !ejected && expectGitToBeClean());
26+
.then(() => expectGitToBeClean());
3027
}

tests/legacy-cli/e2e/tests/build/rebuild-css-change.ts

-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ export default function() {
1414
if (process.platform.startsWith('win')) {
1515
return Promise.resolve();
1616
}
17-
// Skip this in ejected tests.
18-
if (getGlobalVariable('argv').eject) {
19-
return Promise.resolve();
20-
}
21-
2217

2318
return execAndWaitForOutputToMatch('ng', ['serve'], webpackGoodRegEx)
2419
// Should trigger a rebuild.

tests/legacy-cli/e2e/tests/build/rebuild-deps-type-check.ts

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ export default function() {
1818
if (process.platform.startsWith('win')) {
1919
return Promise.resolve();
2020
}
21-
// Skip this in ejected tests.
22-
if (getGlobalVariable('argv').eject) {
23-
return Promise.resolve();
24-
}
2521

2622
return Promise.resolve()
2723
// Create and import files.

tests/legacy-cli/e2e/tests/build/rebuild-error.ts

-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ export default function () {
2525
if (process.platform.startsWith('win')) {
2626
return Promise.resolve();
2727
}
28-
// Skip this in ejected tests.
29-
if (getGlobalVariable('argv').eject) {
30-
return Promise.resolve();
31-
}
3228

3329
// Skip this test in Angular 2/4.
3430
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {

tests/legacy-cli/e2e/tests/build/rebuild-ngfactories.ts

-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ export default function () {
1616
if (process.platform.startsWith('win')) {
1717
return Promise.resolve();
1818
}
19-
// Skip this in ejected tests.
20-
if (getGlobalVariable('argv').eject) {
21-
return Promise.resolve();
22-
}
2319

2420
// Skip this test in Angular 2/4.
2521
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {

tests/legacy-cli/e2e/tests/build/rebuild-types.ts

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ export default async function() {
1515
if (process.platform.startsWith('win')) {
1616
return;
1717
}
18-
// Skip this in ejected tests.
19-
if (getGlobalVariable('argv').eject) {
20-
return;
21-
}
2218

2319
await writeFile('src/app/type.ts', `export type MyType = number;`);
2420
await prependToFile('src/app/app.component.ts', 'import { MyType } from "./type";\n');

tests/legacy-cli/e2e/tests/build/service-worker.ts

-13
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ const MANIFEST = {
2323
};
2424

2525
export default function() {
26-
// Skip this in ejected tests.
27-
if (getGlobalVariable('argv').eject) {
28-
return Promise.resolve();
29-
}
30-
3126
// Can't use the `ng` helper because somewhere the environment gets
3227
// stuck to the first build done
3328
return silentNpm('remove', '@angular/service-worker')
@@ -46,12 +41,4 @@ export default function() {
4641
.then(() => ng('build', '--optimization'))
4742
.then(() => expectFileToExist('dist/test-project/safety-worker.js'))
4843
.then(() => expectFileToExist('dist/test-project/worker-basic.min.js'));
49-
// WEBPACK4_DISABLED - eject temporarily disabled for webpack 4 integration
50-
// .then(() => ng('eject', '--prod'))
51-
// .then(() => silentNpm('install'))
52-
// .then(() => npm('run', 'build'))
53-
// .then(() => expectFileToMatch('package.json', /"sw-config"/))
54-
// .then(() => expectFileToExist(join(process.cwd(), 'dist/ngsw-worker.js')))
55-
// .then(() => expectFileToExist(join(process.cwd(), 'dist/ngsw.json')))
56-
// .then(() => ng('set', 'apps.0.serviceWorker=false'));
5744
}

tests/legacy-cli/e2e/tests/build/styles/imports.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import { getGlobalVariable } from '../../../utils/env';
1212
export default function () {
1313
// TODO(architect): Delete this test. It is now in devkit/build-angular.
1414

15-
// Disable parts of it in webpack tests.
16-
const ejected = getGlobalVariable('argv').eject;
17-
1815
const extensions = ['css', 'scss', 'less', 'styl'];
1916
let promise = Promise.resolve();
2017

@@ -64,7 +61,7 @@ export default function () {
6461
.then(() => expectFileToMatch('dist/test-project/main.js',
6562
/h1.*background:\s*#000+/))
6663
// Also check imports work on ng test
67-
.then(() => !ejected && ng('test', '--watch=false'))
64+
.then(() => ng('test', '--watch=false'))
6865
.then(() => updateJsonFile('angular.json', workspaceJson => {
6966
const appArchitect = workspaceJson.projects['test-project'].architect;
7067
appArchitect.build.options.styles = [

tests/legacy-cli/e2e/tests/commands/build/build-outdir.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ export default function() {
1212
appArchitect.build.options.outputPath = './';
1313
}))
1414
.then(() => expectToFail(() => ng('build')))
15-
.then(() => expectToFail(() => ng('serve')))
16-
.then(() => expectToFail(() => ng('eject')));
15+
.then(() => expectToFail(() => ng('serve')));
1716
}

tests/legacy-cli/e2e/utils/process.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -181,24 +181,11 @@ export function execAndWaitForOutputToMatch(cmd: string, args: string[], match:
181181
}
182182
}
183183

184-
let npmInstalledEject = false;
185184
export function ng(...args: string[]) {
186185
const argv = getGlobalVariable('argv');
187186
const maybeSilentNg = argv['nosilent'] ? noSilentNg : silentNg;
188187
if (['build', 'serve', 'test', 'e2e', 'xi18n'].indexOf(args[0]) != -1) {
189-
// If we have the --eject, use webpack for the test.
190-
if (args[0] == 'build' && argv.eject) {
191-
return maybeSilentNg('eject', ...args.slice(1), '--force')
192-
.then(() => {
193-
if (!npmInstalledEject) {
194-
npmInstalledEject = true;
195-
// We need to delete node_modules, then run npm install on the first eject.
196-
return rimraf('node_modules').then(() => silentNpm('install'));
197-
}
198-
})
199-
.then(() => rimraf('dist'))
200-
.then(() => _exec({silent: true}, 'node_modules/.bin/webpack', []));
201-
} else if (args[0] == 'e2e') {
188+
if (args[0] == 'e2e') {
202189
// Wait 1 second before running any end-to-end test.
203190
return new Promise(resolve => setTimeout(resolve, 1000))
204191
.then(() => maybeSilentNg(...args));

tests/legacy-cli/e2e_runner.ts

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ const argv = minimist(process.argv.slice(2), {
4646
'boolean': [
4747
'appveyor',
4848
'debug',
49-
'eject',
5049
'ng-snapshots',
5150
'noglobal',
5251
'nosilent',

0 commit comments

Comments
 (0)