mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
test: remove all references to eject from CLI E2E tests
This commit is contained in:
parent
f58a7ded00
commit
31abb81482
@ -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'));
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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'))
|
||||
|
@ -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\/";/));
|
||||
}
|
||||
|
@ -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/))
|
||||
|
@ -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());
|
||||
|
@ -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'))
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
@ -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'));
|
||||
}
|
||||
|
@ -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 = [
|
||||
|
@ -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')));
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -46,7 +46,6 @@ const argv = minimist(process.argv.slice(2), {
|
||||
'boolean': [
|
||||
'appveyor',
|
||||
'debug',
|
||||
'eject',
|
||||
'ng-snapshots',
|
||||
'noglobal',
|
||||
'nosilent',
|
||||
|
Loading…
x
Reference in New Issue
Block a user