mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
test(@angular/cli): remove E2E tests which are not used
This commit is contained in:
parent
430ee441bd
commit
1fcc120b16
@ -1,11 +0,0 @@
|
||||
import { ng } from '../../utils/process';
|
||||
import { replaceInFile } from '../../utils/fs';
|
||||
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => replaceInFile('src/app/app.component.ts',
|
||||
'@Component({',
|
||||
'@Component({ moduleId: module.id,'))
|
||||
.then(() => ng('build', '--configuration=development'));
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
import {join} from 'path';
|
||||
import {getGlobalVariable} from '../../utils/env';
|
||||
import {expectFileNotToExist, expectFileToExist, expectFileToMatch, writeFile} from '../../utils/fs';
|
||||
import { installPackage, uninstallPackage } from '../../utils/packages';
|
||||
import {ng} from '../../utils/process';
|
||||
|
||||
const MANIFEST = {
|
||||
index: '/index.html',
|
||||
assetGroups: [{
|
||||
name: 'cli',
|
||||
resources: {
|
||||
files: [
|
||||
'/**/*.html',
|
||||
'/**/*.js',
|
||||
'/**/*.css',
|
||||
'/assets/**/*',
|
||||
'!/ngsw-worker.js',
|
||||
],
|
||||
urls: [
|
||||
'http://test.com/foo/bar',
|
||||
],
|
||||
},
|
||||
}],
|
||||
};
|
||||
|
||||
export default function() {
|
||||
// Can't use the `ng` helper because somewhere the environment gets
|
||||
// stuck to the first build done
|
||||
return uninstallPackage('@angular/service-worker')
|
||||
.then(() => installPackage('@angular/service-worker'))
|
||||
.then(() => ng('config', 'projects.test-project.architect.build.options.serviceWorker', 'true'))
|
||||
.then(() => writeFile('src/ngsw-config.json', JSON.stringify(MANIFEST, null, 2)))
|
||||
.then(() => ng('build', '--optimization'))
|
||||
.then(() => expectFileToExist(join(process.cwd(), 'dist')))
|
||||
.then(() => expectFileToExist(join(process.cwd(), 'dist/test-project/ngsw.json')))
|
||||
.then(() => ng('build', '--optimization', '--base-href=/foo/bar'))
|
||||
.then(() => expectFileToExist(join(process.cwd(), 'dist/test-project/ngsw.json')))
|
||||
.then(() => expectFileToMatch('dist/test-project/ngsw.json', /"\/foo\/bar\/index.html"/))
|
||||
.then(() => ng('build', '--optimization', '--service-worker=false'))
|
||||
.then(() => expectFileNotToExist('dist/test-project/ngsw.json'))
|
||||
.then(() => writeFile('node_modules/@angular/service-worker/safety-worker.js', 'false'))
|
||||
.then(() => ng('build', '--optimization'))
|
||||
.then(() => expectFileToExist('dist/test-project/safety-worker.js'))
|
||||
.then(() => expectFileToExist('dist/test-project/worker-basic.min.js'));
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import {ng} from '../../../utils/process';
|
||||
import {getGlobalVariable} from '../../../utils/env';
|
||||
|
||||
const yarnRegEx = /You can `ng config -g cli.packageManager yarn`./;
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => process.chdir(getGlobalVariable('tmp-root')))
|
||||
.then(() => ng('config', '--global', 'packageManager', 'default'))
|
||||
.then(() => ng('new', 'foo', '--version=1.6.8'))
|
||||
.then(({ stdout }) => {
|
||||
// Assuming yarn is installed and checking for message with yarn.
|
||||
if (!stdout.match(yarnRegEx)) {
|
||||
throw new Error('Should display message to use yarn packageManager');
|
||||
}
|
||||
});
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
import { promisify } from 'util';
|
||||
import {ng} from '../../../utils/process';
|
||||
import {getGlobalVariable} from '../../../utils/env';
|
||||
|
||||
const mkdir = promisify(fs.mkdir);
|
||||
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => process.chdir(getGlobalVariable('tmp-root')))
|
||||
.then(() => mkdir('empty-directory'))
|
||||
.then(() => ng('new', 'foo', '--directory=empty-directory', '--skip-install', '--skip-git'));
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
import {ng} from '../../../utils/process';
|
||||
import {createProject} from '../../../utils/project';
|
||||
import {expectFileNotToExist, expectFileToMatch} from '../../../utils/fs';
|
||||
import {expectToFail} from '../../../utils/utils';
|
||||
|
||||
|
||||
export default function() {
|
||||
// TODO(architect): re-enable after figuring out how a new minimal project looks like.
|
||||
return (
|
||||
Promise.resolve()
|
||||
.then(() => createProject('minimal-project', '--minimal'))
|
||||
.then(() => expectFileNotToExist('.editorconfig'))
|
||||
.then(() => expectFileNotToExist('README.md'))
|
||||
.then(() => expectFileNotToExist('karma.conf.js'))
|
||||
.then(() => expectFileNotToExist('protractor.conf.js'))
|
||||
.then(() => expectFileNotToExist('src/test.ts'))
|
||||
.then(() => expectFileNotToExist('tsconfig.spec.json'))
|
||||
.then(() => expectFileNotToExist('src/app/app.component.html'))
|
||||
.then(() => expectFileNotToExist('src/app/app.component.css'))
|
||||
.then(() => expectFileNotToExist('src/app/app.component.spec.ts'))
|
||||
.then(() => expectFileNotToExist('src/app/favicon.ico'))
|
||||
|
||||
.then(() => expectToFail(() => expectFileToMatch('package.json', '"protractor":')))
|
||||
.then(() => expectToFail(() => expectFileToMatch('package.json', '"karma":')))
|
||||
.then(() => expectToFail(() => expectFileToMatch('package.json', '"jasmine-core":')))
|
||||
|
||||
// Try to run a build.
|
||||
.then(() => ng('build', '--configuration=development'))
|
||||
);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
import {ng} from '../../../utils/process';
|
||||
import {createProject} from '../../../utils/project';
|
||||
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => createProject('routing-project', '--routing'))
|
||||
|
||||
// Try to run the unit tests.
|
||||
.then(() => ng('test', '--watch=false'));
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
import {ng} from '../../../utils/process';
|
||||
import {createProject} from '../../../utils/project';
|
||||
import {expectToFail} from '../../../utils/utils';
|
||||
import {expectGitToBeClean} from '../../../utils/git';
|
||||
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => createProject('new-project', '--skip-commit'))
|
||||
.then(() => expectToFail(() => expectGitToBeClean()))
|
||||
|
||||
// Try to run the unit tests.
|
||||
.then(() => ng('test', '--watch=false'));
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
import {createProject} from '../../../utils/project';
|
||||
import {expectFileNotToExist} from '../../../utils/fs';
|
||||
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => createProject('new-project-skip-tests', '--skip-tests'))
|
||||
.then(() => expectFileNotToExist('src/app/app.component.spec.ts'));
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
import {ng} from '../../../utils/process';
|
||||
import {createProject} from '../../../utils/project';
|
||||
import {expectFileToExist} from '../../../utils/fs';
|
||||
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => ng('config', 'defaults.style', 'scss', '--global'))
|
||||
.then(() => createProject('style-project'))
|
||||
.then(() => expectFileToExist('src/app/app.component.scss'))
|
||||
|
||||
// Try to run the unit tests.
|
||||
.then(() => ng('test', '--watch=false'));
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import {ng} from '../../utils/process';
|
||||
import * as fs from '../../utils/fs';
|
||||
|
||||
|
||||
const options = {
|
||||
encoding: 'utf8'
|
||||
};
|
||||
|
||||
|
||||
export default function() {
|
||||
return Promise.resolve()
|
||||
.then(() => fs.prependToFile('./tsconfig.app.json', '\ufeff', options))
|
||||
.then(() => fs.prependToFile('angular.json', '\ufeff', options))
|
||||
.then(() => ng('build', '--environment=dev'));
|
||||
}
|
@ -84,21 +84,6 @@ let allTests = glob
|
||||
.map(name => name.replace(/\\/g, '/'))
|
||||
.sort();
|
||||
|
||||
// TODO: either update or remove these tests.
|
||||
allTests = allTests
|
||||
// IS this test still valid? \/
|
||||
.filter(name => !name.endsWith('/module-id.ts'))
|
||||
// Do we want to support this?
|
||||
.filter(name => !name.endsWith('different-file-format.ts'))
|
||||
// Not sure what this test is meant to test, but with depedency changes it is not valid anymore.
|
||||
.filter(name => !name.endsWith('loaders-resolution.ts'))
|
||||
// NEW COMMAND
|
||||
.filter(name => !name.includes('tests/commands/new/'))
|
||||
// NEEDS devkit change
|
||||
.filter(name => !name.endsWith('/existing-directory.ts'))
|
||||
// Disabled on rc.0 due to needed sync with devkit for changes.
|
||||
.filter(name => !name.endsWith('/service-worker.ts'));
|
||||
|
||||
const shardId = 'shard' in argv ? argv['shard'] : null;
|
||||
const nbShards = (shardId === null ? 1 : argv['nb-shards']) || 2;
|
||||
const tests = allTests.filter(name => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user