test: re-enable disabled architect build tests

This commit is contained in:
Filipe Silva 2018-03-15 12:12:26 +00:00 committed by Hans
parent 38c8463280
commit b75b21f13c
93 changed files with 186 additions and 552 deletions

View File

@ -101,6 +101,7 @@ const expectedWorkspace = {
},
'configurations': {
'production': {
'optimizationLevel': 1,
'outputHashing': 'all',
'sourceMap': false,
'extractCss': true,
@ -182,6 +183,7 @@ const expectedWorkspace = {
},
'configurations': {
'production': {
'optimizationLevel': 1,
'outputHashing': 'all',
'sourceMap': false,
'extractCss': true,

View File

@ -43,6 +43,7 @@ export function createArchitectWorkspace(cliConfig: any): any {
options: browserOptions,
configurations: {
production: {
optimizationLevel: 1,
outputHashing: 'all',
sourceMap: false,
extractCss: true,

View File

@ -3,8 +3,7 @@ import { updateTsConfig } from '../../utils/project';
import { appendToFile, writeFile } from '../../utils/fs';
export default async function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
await writeFile('src/my-js-file.js', 'console.log(1); export const a = 2;');
await appendToFile('src/main.ts', `

View File

@ -4,13 +4,9 @@ import {expectToFail} from '../../../utils/utils';
import {ngVersionMatches} from '../../../utils/version';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This behaviour seems to have changed in devkit/build-webpack. Figure out why.
return;
if (!ngVersionMatches('^4.0.0')) {
return Promise.resolve();
}
return ng('generate', 'component', 'test-component', '--module', 'app.module.ts')
.then(() => prependToFile('src/app/test-component/test-component.component.ts', `
import { Optional, SkipSelf } from '@angular/core';

View File

@ -1,12 +1,11 @@
import {ng} from '../../../utils/process';
import {expectFileToMatch, writeFile, createDir, appendToFile, readFile} from '../../../utils/fs';
import {expectToFail} from '../../../utils/utils';
import {Version} from '../../../../../packages/@angular/cli/upgrade/version';
import {SemVer} from 'semver';
import { ng } from '../../../utils/process';
import { expectFileToMatch, writeFile, createDir, appendToFile, readFile } from '../../../utils/fs';
import { expectToFail } from '../../../utils/utils';
import { Version } from '../../../../../packages/@angular/cli/upgrade/version';
import { SemVer } from 'semver';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
export default function () {
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => createDir('src/locale'))
@ -25,7 +24,7 @@ export default function() {
</xliff>`))
.then(() => appendToFile('src/app/app.component.html',
'<h1 i18n="An introduction header for this sample">Hello i18n!</h1>'))
.then(() => ng('build', '--aot', '--i18n-file', 'src/locale/messages.fr.xlf', '--i18n-format',
.then(() => ng('build', '--aot', '--i18n-file', 'locale/messages.fr.xlf', '--i18n-format',
'xlf', '--i18n-locale', 'fr'))
.then(() => expectFileToMatch('dist/main.js', /Bonjour i18n!/))
.then(() => ng('build', '--aot'))
@ -33,29 +32,9 @@ export default function() {
.then(() => expectFileToMatch('dist/main.js', /Hello i18n!/))
.then(() => appendToFile('src/app/app.component.html',
'<p i18n>Other content</p>'))
.then(() => readFile('node_modules/@angular/compiler-cli/package.json')
.then((compilerCliPackage): any => {
const version = new Version(JSON.parse(compilerCliPackage).version);
if (version.major === 2) {
return expectToFail(() => ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf',
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'ignore'));
} else {
return ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf', '--i18nFormat',
'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'ignore')
.then(() => expectFileToMatch('dist/main.js', /Other content/));
}
})
)
.then(() => readFile('node_modules/@angular/compiler-cli/package.json')
.then((compilerCliPackage): any => {
const version = new Version(JSON.parse(compilerCliPackage).version);
if (version.isGreaterThanOrEqualTo(new SemVer('4.2.0-beta.0')) || version.major === 2) {
return expectToFail(() => ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf',
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'error'));
} else {
return ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf',
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'error');
}
})
);
.then(() => ng('build', '--aot', '--i18nFile', 'locale/messages.fr.xlf', '--i18nFormat',
'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'ignore'))
.then(() => expectFileToMatch('dist/main.js', /Other content/))
.then(() => expectToFail(() => ng('build', '--aot', '--i18nFile', 'locale/messages.fr.xlf',
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'error')));
}

View File

@ -1,48 +0,0 @@
import {
killAllProcesses,
waitForAnyProcessOutputToMatch,
execAndWaitForOutputToMatch,
} from '../../../utils/process';
import { appendToFile } from '../../../utils/fs';
import { getGlobalVariable } from '../../../utils/env';
import { request } from '../../../utils/http';
import { wait } from '../../../utils/utils';
const validBundleRegEx = /: Compiled successfully./;
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
if (process.platform.startsWith('win')) {
return Promise.resolve();
}
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
return Promise.resolve();
}
return execAndWaitForOutputToMatch('ng', ['serve', '--aot'], validBundleRegEx)
// Wait before editing a file.
// Editing too soon seems to trigger a rebuild and throw polling/watch out of whack.
.then(() => wait(2000))
// Check AOT templates are up to date with current code.
.then(() => request('http://localhost:4200/main.js'))
.then((body) => {
if (body.match(/\$\$_E2E_GOLDEN_VALUE_1/)) {
throw new Error('Expected golden value 1 to not be present.');
}
})
.then(() => appendToFile('src/app/app.component.html', '<p> $$_E2E_GOLDEN_VALUE_1 </p>'))
.then(() => waitForAnyProcessOutputToMatch(validBundleRegEx, 20000))
.then(() => request('http://localhost:4200/main.js'))
.then((body) => {
if (!body.match(/\$\$_E2E_GOLDEN_VALUE_1/)) {
throw new Error('Expected golden value 1.');
}
})
.then(() => killAllProcesses(), (err: any) => {
killAllProcesses();
throw err;
});
}

View File

@ -1,38 +0,0 @@
import { ng } from '../../../utils/process';
import { writeFile, moveFile } from '../../../utils/fs';
import { updateJsonFile } from '../../../utils/project';
import { getGlobalVariable } from '../../../utils/env';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// Disable parts of it in webpack tests.
const ejected = getGlobalVariable('argv').eject;
// This test is only for Angular 2/4 projects.
if (!getGlobalVariable('argv').ng2 && !getGlobalVariable('argv').ng4) {
return Promise.resolve();
}
// Check if **/*.spec.ts files are excluded by default.
return Promise.resolve()
// This import would cause aot to fail.
.then(() => writeFile('src/another.component.spec.ts', `
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
`))
.then(() => ng('build', '--aot'))
// Verify backwards compatibility with old project using the shared tsconfig.
.then(() => moveFile('src/tsconfig.app.json', 'src/tsconfig.json'))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson['apps'][0];
app.tsconfig = 'tsconfig.json';
delete app['testTsconfig'];
}))
.then(() => updateJsonFile('src/tsconfig.json', tsconfigJson => {
delete tsconfigJson['exclude'];
delete tsconfigJson['compilerOptions']['types'];
}))
.then(() => ng('build', '--aot'))
.then(() => !ejected && ng('test', '--watch=false'));
}

View File

@ -1,21 +1,10 @@
import { ng } from '../../utils/process';
import { expectFileToMatch, replaceInFile } from '../../utils/fs';
import { updateJsonFile } from '../../utils/project';
import { expectFileToMatch } from '../../utils/fs';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('build', '--base-href', '/myUrl')
.then(() => expectFileToMatch('dist/index.html', /<base href="\/myUrl">/))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson['apps'][0];
app['baseHref'] = '/myUrl';
}))
.then(() => ng('build'))
.then(() => expectFileToMatch('dist/index.html', /<base href="\/myUrl">/))
.then(() => replaceInFile('src/index.html', 'href="/"', 'href=""'))
.then(() => ng('build'))
.then(() => expectFileToMatch('dist/index.html', /<base href="\/myUrl">/));
}

View File

@ -12,8 +12,7 @@ const extraErrors = [
];
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
if (process.platform.startsWith('win')) {
return Promise.resolve();

View File

@ -4,12 +4,11 @@ import { expectToFail } from '../../utils/utils';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('build', '--aot', '--build-optimizer')
.then(() => expectToFail(() => expectFileToMatch('dist/main.js', /\.decorators =/)))
.then(() => ng('build', '--optimization-level', '1'))
.then(() => ng('build', '--prod'))
.then(() => expectToFail(() => expectFileToExist('dist/vendor.js')))
.then(() => expectToFail(() => expectFileToMatch('dist/main.js', /\.decorators =/)));
}

View File

@ -42,7 +42,7 @@ function validateHashes(
}
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return;
let oldHashes: Map<string, string>;

View File

@ -15,8 +15,7 @@ const imgSvg = `
`;
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
// Verify absolute/relative paths in global/component css.
@ -41,16 +40,16 @@ export default function () {
.then(() => expectFileToMatch('dist/styles.css',
/url\('\/assets\/global-img-absolute\.svg'\)/))
.then(() => expectFileToMatch('dist/styles.css',
/global-img-relative\.[0-9a-f]{20}\.png/))
/global-img-relative\.png/))
.then(() => expectFileToMatch('dist/main.js',
'/assets/component-img-absolute.svg'))
.then(() => expectFileToMatch('dist/main.js',
/component-img-relative\.[0-9a-f]{20}\.png/))
/component-img-relative\.png/))
// Check files are correctly created.
.then(() => expectToFail(() => expectFileToExist('dist/global-img-absolute.svg')))
.then(() => expectToFail(() => expectFileToExist('dist/component-img-absolute.svg')))
.then(() => expectFileMatchToExist('./dist', /global-img-relative\.[0-9a-f]{20}\.png/))
.then(() => expectFileMatchToExist('./dist', /component-img-relative\.[0-9a-f]{20}\.png/))
.then(() => expectFileMatchToExist('./dist', /global-img-relative\.png/))
.then(() => expectFileMatchToExist('./dist', /component-img-relative\.png/))
// Check urls with deploy-url scheme are used as is.
.then(() => ng('build', '--base-href=/base/', '--deploy-url=http://deploy.url/',
'--extract-css'))
@ -78,31 +77,31 @@ export default function () {
.then(() => expectFileToMatch('dist/styles.css',
'/base/deploy/assets/global-img-absolute.svg'))
.then(() => expectFileToMatch('dist/styles.css',
/global-img-relative\.[0-9a-f]{20}\.png/))
/global-img-relative\.png/))
.then(() => expectFileToMatch('dist/main.js',
'/base/deploy/assets/component-img-absolute.svg'))
.then(() => expectFileToMatch('dist/main.js',
/deploy\/component-img-relative\.[0-9a-f]{20}\.png/))
/deploy\/component-img-relative\.png/))
// Check with identical base-href and deploy-url flags.
.then(() => ng('build', '--base-href=/base/', '--deploy-url=/base/',
'--extract-css', '--aot'))
.then(() => expectFileToMatch('dist/styles.css',
'/base/assets/global-img-absolute.svg'))
.then(() => expectFileToMatch('dist/styles.css',
/global-img-relative\.[0-9a-f]{20}\.png/))
/global-img-relative\.png/))
.then(() => expectFileToMatch('dist/main.js',
'/base/assets/component-img-absolute.svg'))
.then(() => expectFileToMatch('dist/main.js',
/\/base\/component-img-relative\.[0-9a-f]{20}\.png/))
/\/base\/component-img-relative\.png/))
// Check with only base-href flag.
.then(() => ng('build', '--base-href=/base/',
'--extract-css', '--aot'))
.then(() => expectFileToMatch('dist/styles.css',
'/base/assets/global-img-absolute.svg'))
.then(() => expectFileToMatch('dist/styles.css',
/global-img-relative\.[0-9a-f]{20}\.png/))
/global-img-relative\.png/))
.then(() => expectFileToMatch('dist/main.js',
'/base/assets/component-img-absolute.svg'))
.then(() => expectFileToMatch('dist/main.js',
/component-img-relative\.[0-9a-f]{20}\.png/));
/component-img-relative\.png/));
}

View File

@ -4,8 +4,7 @@ import {deleteFile, expectFileToExist} from '../../utils/fs';
import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {
@ -16,7 +15,7 @@ export default function() {
// This is supposed to fail since there's a missing file
.then(() => deleteFile('src/app/app.component.ts'))
// The build fails but we don't delete the output of the previous build.
.then(() => expectToFail(() => ng('build', '--no-delete-output-path')))
.then(() => expectToFail(() => ng('build', '--delete-output-path=false')))
.then(() => expectFileToExist('dist'))
// By default, output path is always cleared.
.then(() => expectToFail(() => ng('build')))

View File

@ -6,8 +6,7 @@ import { getGlobalVariable } from '../../utils/env';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => writeMultipleFiles({
@ -19,26 +18,19 @@ export default function () {
.then(() => expectFileToMatch('dist/index.html', 'deployUrl/main.js'))
// verify --deploy-url isn't applied to extracted css urls
.then(() => expectFileToMatch('dist/styles.css',
/url\(['"]?more\.[0-9a-f]{20}\.png['"]?\)/))
/url\(['"]?more\.png['"]?\)/))
.then(() => ng('build', '--deploy-url=http://example.com/some/path/', '--extract-css'))
.then(() => expectFileToMatch('dist/index.html', 'http://example.com/some/path/main.js'))
// verify option also works in config
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson['apps'][0];
app['deployUrl'] = 'config-deployUrl/';
}))
.then(() => ng('build'))
.then(() => expectFileToMatch('dist/index.html', 'config-deployUrl/main.js'))
// verify --deploy-url is applied to non-extracted css urls
.then(() => ng('build', '--deploy-url=deployUrl/', '--extract-css=false'))
.then(() => expectFileToMatch('dist/styles.js',
/\(['"]?deployUrl\/more\.[0-9a-f]{20}\.png['"]?\)/))
/\(['"]?deployUrl\/more\.png['"]?\)/))
.then(() => expectFileToMatch('dist/runtime.js',
/__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/runtime.js', /__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/runtime.js', /__webpack_require__\.p = "deployUrl\/";/));
}

View File

@ -5,7 +5,7 @@ import { updateJsonFile } from '../../utils/project';
export default async function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): lazyModules is not yet handled by the compat layer.
return;
// Add a lazy module

View File

@ -3,7 +3,7 @@ import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Dev-server does not yet do this. Fix, reenable, validate, then delete this test.
return;
// Skip this in ejected tests.

View File

@ -4,8 +4,7 @@ import {expectToFail} from '../../utils/utils';
import {ng} from '../../utils/process';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('build', '--prod', '--extract-licenses=false')
.then(() => expectFileToExist(join(process.cwd(), 'dist')))

View File

@ -1,20 +0,0 @@
import {ng} from '../../utils/process';
import {expectFileToExist} from '../../utils/fs';
import {updateJsonFile} from '../../utils/project';
import {copyFile} from '../../utils/fs';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
return Promise.resolve()
.then(() => copyFile('src/index.html', 'src/config-index.html'))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson['apps'][0];
app['outDir'] = 'config-build-output';
app['index'] = 'config-index.html';
}))
.then(() => ng('build'))
.then(() => expectFileToExist('./config-build-output/config-index.html'));
}

View File

@ -5,8 +5,7 @@ import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// Skip this in ejected tests.
if (getGlobalVariable('argv').eject) {

View File

@ -3,8 +3,7 @@ import { ng } from '../../utils/process';
export default async function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
const mainTs = await readFile('src/main.ts');

View File

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

View File

@ -9,8 +9,7 @@ function verifyMedia(css: RegExp, content: RegExp) {
}
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => writeMultipleFiles({

View File

@ -9,7 +9,8 @@ import {expectToFail, wait} from '../../utils/utils';
const webpackGoodRegEx = /: Compiled successfully./;
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This test is behaving oddly both here and in devkit/build-webpack.
// It seems to be because of file watchers.
return;
@ -22,7 +23,7 @@ export default function() {
}
return execAndWaitForOutputToMatch('ng', ['serve', '--poll=10000'], webpackGoodRegEx)
return execAndWaitForOutputToMatch('ng', ['build', '--watch', '--poll=10000'], webpackGoodRegEx)
// Wait before editing a file.
// Editing too soon seems to trigger a rebuild and throw polling out of whack.
.then(() => wait(3000))

View File

@ -3,8 +3,7 @@ import { ng } from '../../utils/process';
import { oneLineTrim } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => ng('build'))

View File

@ -7,15 +7,14 @@ import {getGlobalVariable} from '../../utils/env';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// 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', '--optimization-level', '1')
return ng('build', '--prod')
.then(() => expectFileToExist(join(process.cwd(), 'dist')))
// Check for cache busting hash script src
.then(() => expectFileToMatch('dist/index.html', /main\.[0-9a-f]{20}\.js/))

View File

@ -9,8 +9,7 @@ import {getGlobalVariable} from '../../utils/env';
const webpackGoodRegEx = /: Compiled successfully./;
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
if (process.platform.startsWith('win')) {
return Promise.resolve();

View File

@ -13,8 +13,7 @@ const errorRe = /ERROR in/;
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
if (process.platform.startsWith('win')) {
return Promise.resolve();

View File

@ -18,7 +18,8 @@ const extraErrors = [
];
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This test is behaving oddly both here and in devkit/build-webpack.
// It seems to be because of file watchers.
return;
if (process.platform.startsWith('win')) {
@ -43,7 +44,7 @@ export default function () {
// Add a major static analysis error on a non-main file to the initial build.
.then(() => replaceInFile('./src/app/app.component.ts', `'app-root'`, `(() => 'app-root')()`))
// Should have an error.
.then(() => execAndWaitForOutputToMatch('ng', ['serve', '--aot'], failedRe))
.then(() => execAndWaitForOutputToMatch('ng', ['build', '--watch', '--aot'], failedRe))
.then((results) => {
const stderr = results.stderr;
if (!stderr.includes('Function calls are not supported')

View File

@ -3,14 +3,14 @@ import {
waitForAnyProcessOutputToMatch,
execAndWaitForOutputToMatch,
} from '../../utils/process';
import { appendToFile, writeMultipleFiles, replaceInFile } from '../../utils/fs';
import { request } from '../../utils/http';
import { appendToFile, writeMultipleFiles, replaceInFile, expectFileToMatch } from '../../utils/fs';
import { getGlobalVariable } from '../../utils/env';
const validBundleRegEx = /: Compiled successfully./;
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This test is behaving oddly both here and in devkit/build-webpack.
// It seems to be because of file watchers.
return;
if (process.platform.startsWith('win')) {
@ -26,7 +26,7 @@ export default function () {
return Promise.resolve();
}
return execAndWaitForOutputToMatch('ng', ['serve', '--aot'], validBundleRegEx)
return execAndWaitForOutputToMatch('ng', ['build', '--watch', '--aot'], validBundleRegEx)
.then(() => writeMultipleFiles({
'src/app/app.component.css': `
@import './imported-styles.css';
@ -49,53 +49,24 @@ export default function () {
waitForAnyProcessOutputToMatch(validBundleRegEx, 10000),
appendToFile('src/app/app.component.html', '<p>HTML_REBUILD_STRING<p>')
]))
.then(() => request('http://localhost:4200/main.js'))
.then((body) => {
if (!body.match(/HTML_REBUILD_STRING/)) {
throw new Error('Expected HTML_REBUILD_STRING but it wasn\'t in bundle.');
}
})
.then(() => expectFileToMatch('dist/main.js', 'HTML_REBUILD_STRING'))
// Check if css changes are built.
.then(() => Promise.all([
waitForAnyProcessOutputToMatch(validBundleRegEx, 10000),
appendToFile('src/app/app.component.css', 'CSS_REBUILD_STRING {color: #f00;}')
]))
.then(() => request('http://localhost:4200/main.js'))
.then((body) => {
if (!body.match(/CSS_REBUILD_STRING/)) {
throw new Error('Expected CSS_REBUILD_STRING but it wasn\'t in bundle.');
}
})
.then(() => expectFileToMatch('dist/main.js', 'CSS_REBUILD_STRING'))
// Check if css dependency changes are built.
.then(() => Promise.all([
waitForAnyProcessOutputToMatch(validBundleRegEx, 10000),
appendToFile('src/app/imported-styles.css', 'CSS_DEP_REBUILD_STRING {color: #f00;}')
]))
.then(() => request('http://localhost:4200/main.js'))
.then((body) => {
if (!body.match(/CSS_DEP_REBUILD_STRING/)) {
throw new Error('Expected CSS_DEP_REBUILD_STRING but it wasn\'t in bundle.');
}
})
.then(() => {
// Skip this part of the test in Angular 2/4.
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
return Promise.resolve();
}
// Check if component metadata changes are built.
return Promise.resolve()
.then(() => Promise.all([
waitForAnyProcessOutputToMatch(validBundleRegEx, 10000),
replaceInFile('src/app/app.component.ts', 'app-root', 'app-root-FACTORY_REBUILD_STRING')
]))
.then(() => request('http://localhost:4200/main.js'))
.then((body) => {
if (!body.match(/FACTORY_REBUILD_STRING/)) {
throw new Error('Expected FACTORY_REBUILD_STRING but it wasn\'t in bundle.');
}
});
})
.then(() => expectFileToMatch('dist/main.js', 'CSS_DEP_REBUILD_STRING'))
.then(() => Promise.all([
waitForAnyProcessOutputToMatch(validBundleRegEx, 10000),
replaceInFile('src/app/app.component.ts', 'app-root', 'app-root-FACTORY_REBUILD_STRING')
]))
.then(() => expectFileToMatch('dist/main.js', 'FACTORY_REBUILD_STRING'))
.then(() => killAllProcesses(), (err: any) => {
killAllProcesses();
throw err;

View File

@ -10,8 +10,7 @@ import {getGlobalVariable} from '../../utils/env';
const successRe = /: Compiled successfully/;
export default async function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
if (process.platform.startsWith('win')) {
return;

View File

@ -5,8 +5,7 @@ import { getGlobalVariable } from '../../utils/env';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// Skip this test in Angular 2, it had different bundles.
if (getGlobalVariable('argv').ng2) {

View File

@ -4,8 +4,7 @@ import {expectToFail} from '../../utils/utils';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('build', '--source-map')
.then(() => expectFileToExist('dist/main.js.map'))

View File

@ -3,8 +3,7 @@ import { ng } from '../../../utils/process';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
// Write assets.

View File

@ -9,8 +9,7 @@ import { expectToFail } from '../../../utils/utils';
import { oneLineTrim } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => writeMultipleFiles({

View File

@ -10,8 +10,7 @@ import { updateJsonFile } from '../../../utils/project';
import { getGlobalVariable } from '../../../utils/env';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// Disable parts of it in webpack tests.
const ejected = getGlobalVariable('argv').eject;

View File

@ -8,7 +8,7 @@ import { ng } from '../../../utils/process';
import { updateJsonFile } from '../../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): The compat layer doesn't yet process `includePaths`.
return;
return Promise.resolve()

View File

@ -16,8 +16,7 @@ const imgSvg = `
`;
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => silentNpm('install', 'font-awesome@4.7.0'))
@ -50,17 +49,17 @@ export default function () {
})
// Check paths are correctly generated.
.then(() => expectFileToMatch('dist/styles.css',
/url\(['"]?large\.[0-9a-f]{20}\.png['"]?\),\s+linear-gradient\(to bottom, #0e40fa 25%, #0654f4 75%\);/))
/url\(['"]?large\.png['"]?\),\s+linear-gradient\(to bottom, #0e40fa 25%, #0654f4 75%\);/))
.then(() => expectFileToMatch('dist/styles.css',
/url\(\\?['"]data:image\/svg\+xml/))
.then(() => expectFileToMatch('dist/styles.css',
/url\(['"]?small-id\.[0-9a-f]{20}\.svg#testID['"]?\)/))
/url\(['"]?small-id\.svg#testID['"]?\)/))
.then(() => expectFileToMatch('dist/main.js',
/url\(\\?['"]data:image\/svg\+xml/))
.then(() => expectFileToMatch('dist/main.js',
/url\((?:['"]|\\')?large\.[0-9a-f]{20}\.png(?:['"]|\\')?\)/))
/url\((?:['"]|\\')?large\.png(?:['"]|\\')?\)/))
// Check files are correctly created.
.then(() => expectToFail(() => expectFileToExist('dist/small.svg')))
.then(() => expectFileMatchToExist('./dist', /large\.[0-9a-f]{20}\.png/))
.then(() => expectFileMatchToExist('./dist', /small-id\.[0-9a-f]{20}\.svg/));
.then(() => expectFileMatchToExist('./dist', /large\.png/))
.then(() => expectFileMatchToExist('./dist', /small-id\.svg/));
}

View File

@ -10,8 +10,7 @@ import { stripIndents } from 'common-tags';
import { updateJsonFile } from '../../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return writeMultipleFiles({
'src/styles.less': stripIndents`

View File

@ -10,8 +10,7 @@ import { updateJsonFile } from '../../../utils/project';
import { expectToFail } from '../../../utils/utils';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return writeMultipleFiles({
'src/styles.scss': stripIndents`

View File

@ -7,8 +7,7 @@ import { stripIndents } from 'common-tags';
import { updateJsonFile } from '../../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
const extensions = ['css', 'scss', 'less', 'styl'];
let promise: Promise<any> = Promise.resolve()

View File

@ -4,8 +4,7 @@ import { ng } from '../../../utils/process';
import { stripIndents } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return writeFile('src/styles.css', stripIndents`
/* normal-comment */
@ -20,7 +19,7 @@ export default function () {
div { -webkit-box-flex: 1; -ms-flex: 1; flex: 1 }
`))
// uses postcss-discard-comments plugin for prod
.then(() => ng('build', '--optimization-level', '1'))
.then(() => ng('build', '--prod'))
.then(() => glob.sync('dist/styles.*.css').find(file => !!file))
.then((stylesBundle) => expectFileToMatch(stylesBundle, stripIndents`
/*! important-comment */div{-webkit-box-flex:1;-ms-flex:1;flex:1}

View File

@ -10,8 +10,7 @@ import { stripIndents } from 'common-tags';
import { updateJsonFile } from '../../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return writeMultipleFiles({
'src/styles.scss': stripIndents`

View File

@ -10,8 +10,7 @@ import { stripIndents } from 'common-tags';
import { updateJsonFile } from '../../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return writeMultipleFiles({
'src/styles.styl': stripIndents`

View File

@ -5,8 +5,7 @@ import { expectToFail } from '../../utils/utils';
const integrityRe = /integrity="\w+-[A-Za-z0-9\/\+=]+"/;
export default async function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// WEBPACK4_DISABLED - disabled pending a webpack 4 version
return;

View File

@ -5,8 +5,7 @@ import {stripIndents} from 'common-tags';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return updateTsConfig(json => {
json['compilerOptions']['baseUrl'] = './';

View File

@ -4,11 +4,10 @@ import {expectToFail} from '../../utils/utils';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('build')
.then(() => expectFileToExist('dist/vendor.js'))
.then(() => ng('build', '--no-vendor-chunk'))
.then(() => ng('build', '--vendor-chunk=false'))
.then(() => expectToFail(() => expectFileToExist('dist/vendor.js')));
}

View File

@ -10,7 +10,8 @@ import { expectToFail } from '../../utils/utils';
const webpackGoodRegEx = /: Compiled successfully./;
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This test is behaving oddly both here and in devkit/build-webpack.
// It seems to be because of file watchers.
return;
if (process.platform.startsWith('win')) {

View File

@ -3,7 +3,7 @@ import {updateJsonFile} from '../../../utils/project';
import {expectToFail} from '../../../utils/utils';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This isn't working correctly in devkit/build-webpack, due to module resolution.
return;
return Promise.resolve()

View File

@ -3,8 +3,7 @@ import { killAllProcesses } from '../../../utils/process';
import { ngServe } from '../../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => ngServe('--serve-path', 'test/'))
@ -21,12 +20,12 @@ export default function () {
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; })
.then(() => ngServe('--base-href', 'test/'))
.then(() => request('http://localhost:4200/test'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value.');
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; });
// .then(() => ngServe('--base-href', 'test/'))
// .then(() => request('http://localhost:4200/test'))
// .then(body => {
// if (!body.match(/<app-root><\/app-root>/)) {
// throw new Error('Response does not match expected value.');
// }
// })
// .then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; });
}

View File

@ -4,8 +4,7 @@ import { getGlobalVariable } from '../../utils/env';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// Skip this test in Angular 2/4.
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {

View File

@ -7,8 +7,7 @@ import {
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('generate', 'component', 'i18n-test')
.then(() => writeFile(

View File

@ -4,8 +4,7 @@ import { expectToFail } from '../../utils/utils';
import { join } from 'path';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('generate', 'component', 'i18n-test')
.then(() => writeFile(

View File

@ -4,8 +4,7 @@ import { writeFile, expectFileToMatch } from '../../utils/fs';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('generate', 'component', 'i18n-test')
.then(() => writeFile(

View File

@ -4,8 +4,7 @@ import { writeFile, expectFileToMatch } from '../../utils/fs';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('generate', 'component', 'i18n-test')
.then(() => writeFile(

View File

@ -7,8 +7,7 @@ import {
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('generate', 'component', 'i18n-test')
.then(() => writeFile(

View File

@ -2,7 +2,7 @@ import { ng } from '../../utils/process';
import { oneLine } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
return Promise.resolve()

View File

@ -5,7 +5,7 @@ import { oneLine } from 'common-tags';
import { updateJsonFile } from '../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
return Promise.resolve()

View File

@ -3,7 +3,7 @@ import { writeFile } from '../../utils/fs';
import { oneLine } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo.ts';

View File

@ -2,7 +2,7 @@ import { ng } from '../../utils/process';
import { readFile, writeFile } from '../../utils/fs';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo.ts';

View File

@ -3,7 +3,7 @@ import { writeFile } from '../../utils/fs';
import { oneLine } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo.ts';

View File

@ -3,7 +3,7 @@ import { writeFile } from '../../utils/fs';
import { oneLine } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo.ts';

View File

@ -3,7 +3,7 @@ import { writeFile } from '../../utils/fs';
import { oneLine } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo.ts';

View File

@ -4,7 +4,7 @@ import { expectToFail } from '../../utils/utils';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo/foo.ts';

View File

@ -2,7 +2,7 @@ import { ng } from '../../utils/process';
import { expectToFail } from '../../utils/utils';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
return Promise.resolve()

View File

@ -4,7 +4,7 @@ import { writeFile } from '../../utils/fs';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo.ts';

View File

@ -3,7 +3,7 @@ import { writeFile } from '../../utils/fs';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out how this test should look like post devkit/build-webpack.
return;
const fileName = 'src/app/foo.ts';

View File

@ -2,8 +2,7 @@ import { ng } from '../../utils/process';
import { oneLine } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return ng('lint')
.then(({ stdout }) => {

View File

@ -5,8 +5,7 @@ import {expectToFail} from '../../utils/utils';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return writeFile('src/assets/.file', '')
.then(() => writeFile('src/assets/test.abc', 'hello world'))

View File

@ -3,8 +3,7 @@ import { ng } from '../../utils/process';
export default async function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
await prependToFile('src/app/app.component.ts',
`import { AppModule } from './app.module'; console.log(AppModule);`);
@ -12,10 +11,4 @@ export default async function () {
if (!output.stdout.match(/WARNING in Circular dependency detected/)) {
throw new Error('Expected to have circular dependency warning in output.');
}
await ng('config', 'defaults.build.showCircularDependencies', 'false');
output = await ng('build');
if (output.stdout.match(/WARNING in Circular dependency detected/)) {
throw new Error('Expected to not have circular dependency warning in output.');
}
}

View File

@ -7,7 +7,8 @@ import {expectToFail} from '../../utils/utils';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): The common chunk seems to have a different name in devkit/build-webpack.
// Investigate, validate, then delete this test.
return;
return Promise.resolve();

View File

@ -5,7 +5,8 @@ import {ng} from '../../utils/process';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This test is broken in devkit/build-webpack, istanbul and
// istanbul-instrumenter-loader are missing from the dependencies.
return;
return ng('test', '--watch=false', '--code-coverage')

View File

@ -1,24 +0,0 @@
import { request } from '../../utils/http';
import { killAllProcesses } from '../../utils/process';
import { ngServe } from '../../utils/project';
import { updateJsonFile } from '../../utils/project';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
return Promise.resolve()
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson.defaults;
app.serve = { port: 4201 };
}))
.then(() => ngServe())
.then(() => request('http://localhost:4201/'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value.');
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; });
}

View File

@ -1,37 +0,0 @@
import { killAllProcesses } from '../../utils/process';
import { request } from '../../utils/http';
import { ngServe, updateJsonFile } from '../../utils/project';
import { writeMultipleFiles } from '../../utils/fs';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
return Promise.resolve()
.then(() => writeMultipleFiles({
'src/string-script.js': 'console.log(\'string-script\'); var number = 1+1;',
})
.then(() => updateJsonFile('.angular-cli.json', configJson => {
configJson['apps'][0]['scripts'] = [
'string-script.js',
];
}))
// check when setup through command line arguments
.then(() => ngServe('--deploy-url', '/deployurl/', '--base-href', '/deployurl/'))
.then(() => request('http://localhost:4200'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value. (1)');
}
if (!body.match(/"\/deployurl\/scripts.js"/)) {
throw new Error('Response does not match expected value. (2)');
}
})
.then(() => request('http://localhost:4200/deployurl/'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value. (3)');
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; });
}

View File

@ -6,8 +6,7 @@ import { moveFile } from '../../utils/fs';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// should fallback to config.app[0].index (index.html by default)
return Promise.resolve()

View File

@ -5,8 +5,7 @@ import {appendToFile, writeFile, prependToFile, replaceInFile} from '../../utils
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
let oldNumberOfFiles = 0;
return Promise.resolve()

View File

@ -3,7 +3,7 @@ import { ng } from '../../utils/process';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out what a minimal config is for architect apps.
return;
return Promise.resolve()

View File

@ -3,8 +3,7 @@ import { ng } from '../../utils/process';
export default async function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
await writeMultipleFiles({
'./src/app/foo.ts': `

View File

@ -9,8 +9,7 @@ import {updateJsonFile} from '../../utils/project';
import {expectToFail} from "../../utils/utils";
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// Create an express app that serves as a proxy.
const app = express();
@ -34,7 +33,7 @@ export default function() {
return Promise.resolve()
.then(() => writeFile(proxyConfigFile, JSON.stringify(proxyConfig, null, 2)))
.then(() => ngServe('--proxy-config', proxyConfigFile))
.then(() => ngServe('--proxy-config', '../' + proxyConfigFile))
.then(() => request('http://localhost:4200/api/test'))
.then(body => {
if (!body.match(/TEST_API_RETURN/)) {
@ -43,30 +42,30 @@ export default function() {
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; })
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson.defaults;
app.serve = {
proxyConfig: proxyConfigFile
};
}))
.then(() => ngServe())
.then(() => request('http://localhost:4200/api/test'))
.then(body => {
if (!body.match(/TEST_API_RETURN/)) {
throw new Error('Response does not match expected value.');
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; })
// .then(() => updateJsonFile('.angular-cli.json', configJson => {
// const app = configJson.defaults;
// app.serve = {
// proxyConfig: proxyConfigFile
// };
// }))
// .then(() => ngServe())
// .then(() => request('http://localhost:4200/api/test'))
// .then(body => {
// if (!body.match(/TEST_API_RETURN/)) {
// throw new Error('Response does not match expected value.');
// }
// })
// .then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; })
.then(() => server.close(), (err) => { server.close(); throw err; })
// A non-existing proxy file should error.
.then(() => expectToFail(() => ng('serve', '--proxy-config', 'proxy.non-existent.json')))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson.defaults;
app.serve = {
proxyConfig: 'proxy.non-existent.json'
};
}))
.then(() => expectToFail(() => ng('serve')));
// // A non-existing proxy file should error.
// .then(() => expectToFail(() => ng('serve', '--proxy-config', 'proxy.non-existent.json')))
// .then(() => updateJsonFile('.angular-cli.json', configJson => {
// const app = configJson.defaults;
// app.serve = {
// proxyConfig: 'proxy.non-existent.json'
// };
// }))
// .then(() => expectToFail(() => ng('serve')));
}

View File

@ -6,8 +6,7 @@ import { killAllProcesses } from '../../utils/process';
import { ngServe } from '../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
const firstLocalIp = _(os.networkInterfaces())
.values()

View File

@ -1,24 +0,0 @@
import { request } from '../../utils/http';
import { killAllProcesses } from '../../utils/process';
import { ngServe } from '../../utils/project';
import { updateJsonFile } from '../../utils/project';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
return Promise.resolve()
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson.defaults;
app.serve = { ssl: true };
}))
.then(() => ngServe())
.then(() => request('https://localhost:4200/'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value.');
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; });
}

View File

@ -4,8 +4,7 @@ import { ngServe } from '../../utils/project';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => ngServe('--ssl', 'true'))

View File

@ -1,30 +0,0 @@
import { request } from '../../utils/http';
import { assetDir } from '../../utils/assets';
import { killAllProcesses } from '../../utils/process';
import { ngServe } from '../../utils/project';
import { updateJsonFile } from '../../utils/project';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
return Promise.resolve()
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson.defaults;
app.serve = {
ssl: true,
sslKey: assetDir('ssl/server.key'),
sslCert: assetDir('ssl/server.crt')
};
}))
.then(() => ngServe())
.then(() => request('https://localhost:4200/'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value.');
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; });
}

View File

@ -5,8 +5,7 @@ import { ngServe } from '../../utils/project';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => ngServe(

View File

@ -5,19 +5,18 @@ import { updateJsonFile } from '../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out why this test is not working.
return;
return Promise.resolve()
.then(() => expectToFail(() => ng('e2e', '--no-serve')))
.then(() => expectToFail(() => ng('e2e', '--devServerTarget=')))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson.defaults;
app.serve = { port: 4400 };
}))
.then(() => ngServe())
.then(() => expectToFail(() => ng('e2e', '--no-serve')))
.then(() => ng('e2e', '--no-serve', '--base-href=http://localhost:4400'))
.then(() => ng('e2e', '--no-serve', '--port=4400'))
.then(() => ng('e2e', '--devServerTarget=', '--base-url=http://localhost:4400'))
.then(() => ng('e2e', '--devServerTarget=', '--port=4400'))
.then(() => killAllProcesses(), (err: any) => {
killAllProcesses();
throw err;

View File

@ -6,7 +6,7 @@ import { stripIndent } from 'common-tags';
// Make sure asset files are served
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): Figure out why this test is not working.
return;
return Promise.resolve()

View File

@ -1,25 +0,0 @@
import { ng } from '../../utils/process';
import { replaceInFile } from '../../utils/fs';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// Old configs (with the cli preprocessor listed) should still supported.
return Promise.resolve()
.then(() => replaceInFile('karma.conf.js',
'coverageIstanbulReporter: {', `
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
`))
.then(() => ng('test', '--watch=false'));
}

View File

@ -2,7 +2,7 @@ import { ng } from '../../utils/process';
import { writeFile } from '../../utils/fs';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): re-enable after build-webpack supports this functionality.
return;
// Tests run in 'dev' environment by default.

View File

@ -4,8 +4,7 @@ import { expectToFail } from '../../utils/utils';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
// Fails on single run with broken compilation.
return writeFile('src/app.component.spec.ts', '<p> definitely not typescript </p>')

View File

@ -11,7 +11,8 @@ import { readFile, writeFile } from '../../utils/fs';
const karmaGoodRegEx = /Executed 3 of 3 SUCCESS \(\d+\.\d+ secs/;
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This test is behaving oddly both here and in devkit/build-webpack.
// It seems to be because of file watchers.
return;
let originalSpec: string;

View File

@ -6,8 +6,7 @@ import { stripIndent } from 'common-tags';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => ng('test', '--watch=false'))

View File

@ -2,7 +2,8 @@ import { ng } from '../../utils/process';
import { updateJsonFile } from '../../utils/project';
export default function () {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
// TODO(architect): This is giving odd errors in devkit/build-webpack.
// TypeError: Assignment to constant variable.
return;
return updateJsonFile('tsconfig.json', configJson => {

View File

@ -5,8 +5,7 @@ import {oneLineTrim} from 'common-tags';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => silentNpm('install', 'bootstrap@4.0.0-beta.3'))
@ -29,9 +28,10 @@ export default function() {
`))
.then(() => ng(
'build',
'--optimization-level', '1',
'--optimization-level=1',
'--extract-css',
'--output-hashing=none'
'--output-hashing=none',
'--vendor-chunk=false',
))
.then(() => expectFileToMatch('dist/scripts.js', 'jQuery'))
.then(() => expectFileToMatch('dist/styles.css', '* Bootstrap'))

View File

@ -4,8 +4,7 @@ import {expectFileToMatch} from '../../utils/fs';
export default function() {
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
return;
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
return Promise.resolve()
.then(() => silentNpm('install', 'material-design-icons@3.0.1'))