test: remove all references to eject from CLI E2E tests

This commit is contained in:
Charles Lyding 2019-02-15 12:02:41 -05:00 committed by Alex Eagle
parent f58a7ded00
commit 31abb81482
22 changed files with 9 additions and 114 deletions

View File

@ -8,7 +8,6 @@ import {
import { ng } from '../../utils/process';
import { updateJsonFile } from '../../utils/project';
import { expectToFail } from '../../utils/utils';
import {getGlobalVariable} from '../../utils/env';
// const temp = require('temp');
@ -17,7 +16,6 @@ import {getGlobalVariable} from '../../utils/env';
// tslint:disable:max-line-length
export default function () {
// Disable parts of it in webpack tests.
const ejected = getGlobalVariable('argv').eject;
// TODO: update test
return;
@ -110,7 +108,7 @@ export default function () {
// .gitkeep shouldn't be copied.
.then(() => expectToFail(() => expectFileToExist('dist/assets/.gitkeep')))
// Update app to test assets are present.
.then(_ => !ejected && writeMultipleFiles({
.then(_ => writeMultipleFiles({
'src/app/app.module.ts': `
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
@ -191,6 +189,6 @@ export default function () {
});
});`,
}))
.then(() => !ejected && ng('test', '--watch=false'))
.then(() => !ejected && ng('e2e', 'test-project-e2e'));
.then(() => ng('test', '--watch=false'))
.then(() => ng('e2e', 'test-project-e2e'));
}

View File

@ -7,7 +7,6 @@ import {
import {writeFile, writeMultipleFiles} from '../../utils/fs';
import {wait} from '../../utils/utils';
import {request} from '../../utils/http';
import {getGlobalVariable} from '../../utils/env';
const validBundleRegEx = /: Compiled successfully./;
@ -15,10 +14,6 @@ export default function() {
if (process.platform.startsWith('win')) {
return Promise.resolve();
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
const lazyChunkRegExp = /lazy-module\.js/g;

View File

@ -7,11 +7,6 @@ import { readNgVersion } from '../../utils/version';
export default function () {
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
// Skip this test in Angular 2/4.
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
return Promise.resolve();

View File

@ -8,11 +8,6 @@ import { stripIndent } from 'common-tags';
export default function () {
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
// Skip this test in Angular 2/4.
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
return Promise.resolve();

View File

@ -19,11 +19,6 @@ export default function () {
return Promise.resolve();
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
// Skip this test in Angular 2/4.
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
return Promise.resolve();

View File

@ -6,11 +6,6 @@ import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): Delete this test. It is now in devkit/build-angular.
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
return ng('build')
// This is supposed to fail since there's a missing file
.then(() => deleteFile('src/app/app.component.ts'))

View File

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

View File

@ -1,16 +1,10 @@
import {execAndWaitForOutputToMatch, killAllProcesses} from '../../utils/process';
import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): Dev-server does not yet do this. Fix, reenable, validate, then delete this test.
return;
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
return Promise.resolve()
// Check that ng serve has eval sourcemaps by default.
.then(() => execAndWaitForOutputToMatch('ng', ['serve'], /: Compiled successfully/))

View File

@ -7,11 +7,6 @@ import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): Delete this test. It is now in devkit/build-angular.
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
return ng('build', '--stats-json')
.then(() => expectFileToExist('./dist/test-project/stats.json'))
.then(() => expectGitToBeClean());

View File

@ -9,11 +9,6 @@ import {expectToFail} from '../../utils/utils';
export default function() {
// TODO(architect): Delete this test. It is now in devkit/build-angular.
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
return ng('build', '--output-path', 'build-output')
.then(() => expectFileToExist('./build-output/index.html'))
.then(() => expectFileToExist('./build-output/main.js'))

View File

@ -14,11 +14,6 @@ import { readNgVersion } from '../../utils/version';
import { expectToFail } from '../../utils/utils';
export default function () {
// Skip this for ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
let platformServerVersion = readNgVersion();
let httpVersion = readNgVersion();

View File

@ -9,9 +9,6 @@ import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): Delete this test. It is now in devkit/build-angular.
// Skip this in ejected tests.
const ejected = getGlobalVariable('argv').eject;
// Can't use the `ng` helper because somewhere the environment gets
// stuck to the first build done
return ng('build', '--prod')
@ -26,5 +23,5 @@ export default function() {
expectFileToMatch(`dist/test-project/${main}`, /bootstrapModuleFactory\(/);
})
// Check that the process didn't change local files.
.then(() => !ejected && expectGitToBeClean());
.then(() => expectGitToBeClean());
}

View File

@ -14,11 +14,6 @@ export default function() {
if (process.platform.startsWith('win')) {
return Promise.resolve();
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
return execAndWaitForOutputToMatch('ng', ['serve'], webpackGoodRegEx)
// Should trigger a rebuild.

View File

@ -18,10 +18,6 @@ export default function() {
if (process.platform.startsWith('win')) {
return Promise.resolve();
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
return Promise.resolve()
// Create and import files.

View File

@ -25,10 +25,6 @@ export default function () {
if (process.platform.startsWith('win')) {
return Promise.resolve();
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
// Skip this test in Angular 2/4.
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {

View File

@ -16,10 +16,6 @@ export default function () {
if (process.platform.startsWith('win')) {
return Promise.resolve();
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
// Skip this test in Angular 2/4.
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {

View File

@ -15,10 +15,6 @@ export default async function() {
if (process.platform.startsWith('win')) {
return;
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return;
}
await writeFile('src/app/type.ts', `export type MyType = number;`);
await prependToFile('src/app/app.component.ts', 'import { MyType } from "./type";\n');

View File

@ -23,11 +23,6 @@ const MANIFEST = {
};
export default function() {
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
// Can't use the `ng` helper because somewhere the environment gets
// stuck to the first build done
return silentNpm('remove', '@angular/service-worker')
@ -46,12 +41,4 @@ export default function() {
.then(() => ng('build', '--optimization'))
.then(() => expectFileToExist('dist/test-project/safety-worker.js'))
.then(() => expectFileToExist('dist/test-project/worker-basic.min.js'));
// WEBPACK4_DISABLED - eject temporarily disabled for webpack 4 integration
// .then(() => ng('eject', '--prod'))
// .then(() => silentNpm('install'))
// .then(() => npm('run', 'build'))
// .then(() => expectFileToMatch('package.json', /"sw-config"/))
// .then(() => expectFileToExist(join(process.cwd(), 'dist/ngsw-worker.js')))
// .then(() => expectFileToExist(join(process.cwd(), 'dist/ngsw.json')))
// .then(() => ng('set', 'apps.0.serviceWorker=false'));
}

View File

@ -12,9 +12,6 @@ import { getGlobalVariable } from '../../../utils/env';
export default function () {
// TODO(architect): Delete this test. It is now in devkit/build-angular.
// Disable parts of it in webpack tests.
const ejected = getGlobalVariable('argv').eject;
const extensions = ['css', 'scss', 'less', 'styl'];
let promise = Promise.resolve();
@ -64,7 +61,7 @@ export default function () {
.then(() => expectFileToMatch('dist/test-project/main.js',
/h1.*background:\s*#000+/))
// Also check imports work on ng test
.then(() => !ejected && ng('test', '--watch=false'))
.then(() => ng('test', '--watch=false'))
.then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [

View File

@ -12,6 +12,5 @@ export default function() {
appArchitect.build.options.outputPath = './';
}))
.then(() => expectToFail(() => ng('build')))
.then(() => expectToFail(() => ng('serve')))
.then(() => expectToFail(() => ng('eject')));
.then(() => expectToFail(() => ng('serve')));
}

View File

@ -181,24 +181,11 @@ export function execAndWaitForOutputToMatch(cmd: string, args: string[], match:
}
}
let npmInstalledEject = false;
export function ng(...args: string[]) {
const argv = getGlobalVariable('argv');
const maybeSilentNg = argv['nosilent'] ? noSilentNg : silentNg;
if (['build', 'serve', 'test', 'e2e', 'xi18n'].indexOf(args[0]) != -1) {
// If we have the --eject, use webpack for the test.
if (args[0] == 'build' && argv.eject) {
return maybeSilentNg('eject', ...args.slice(1), '--force')
.then(() => {
if (!npmInstalledEject) {
npmInstalledEject = true;
// We need to delete node_modules, then run npm install on the first eject.
return rimraf('node_modules').then(() => silentNpm('install'));
}
})
.then(() => rimraf('dist'))
.then(() => _exec({silent: true}, 'node_modules/.bin/webpack', []));
} else if (args[0] == 'e2e') {
if (args[0] == 'e2e') {
// Wait 1 second before running any end-to-end test.
return new Promise(resolve => setTimeout(resolve, 1000))
.then(() => maybeSilentNg(...args));

View File

@ -46,7 +46,6 @@ const argv = minimist(process.argv.slice(2), {
'boolean': [
'appveyor',
'debug',
'eject',
'ng-snapshots',
'noglobal',
'nosilent',