refactor(ngcc): rename INVALID_ENTRY_POINT to INCOMPATIBLE_ENTRY_POINT (#36305)

This name better reflects its meaning.

PR Close #36305
This commit is contained in:
Pete Bacon Darwin
2020-03-30 11:12:54 +01:00
committed by Alex Rickabaugh
parent 3545a49a79
commit de594ca221
6 changed files with 28 additions and 26 deletions

View File

@ -10,7 +10,7 @@ import {AbsoluteFsPath, FileSystem, absoluteFrom, getFileSystem} from '../../../
import {runInEachFileSystem} from '../../../src/ngtsc/file_system/testing';
import {loadTestFiles} from '../../../test/helpers';
import {NgccConfiguration} from '../../src/packages/configuration';
import {EntryPoint, INVALID_ENTRY_POINT, NO_ENTRY_POINT, SUPPORTED_FORMAT_PROPERTIES, getEntryPointFormat, getEntryPointInfo} from '../../src/packages/entry_point';
import {EntryPoint, INCOMPATIBLE_ENTRY_POINT, NO_ENTRY_POINT, SUPPORTED_FORMAT_PROPERTIES, getEntryPointFormat, getEntryPointInfo} from '../../src/packages/entry_point';
import {MockLogger} from '../helpers/mock_logger';
runInEachFileSystem(() => {
@ -165,7 +165,7 @@ runInEachFileSystem(() => {
});
it('should return `INVALID_ENTRY_POINT` if there is no typings or types field in the package.json',
it('should return `INCOMPATIBLE_ENTRY_POINT` if there is no typings or types field in the package.json',
() => {
loadTestFiles([
{
@ -182,10 +182,10 @@ runInEachFileSystem(() => {
const entryPoint = getEntryPointInfo(
fs, config, new MockLogger(), SOME_PACKAGE,
_('/project/node_modules/some_package/missing_typings'));
expect(entryPoint).toBe(INVALID_ENTRY_POINT);
expect(entryPoint).toBe(INCOMPATIBLE_ENTRY_POINT);
});
it('should return `INVALID_ENTRY_POINT` if the typings or types field is not a string in the package.json',
it('should return `INCOMPATIBLE_ENTRY_POINT` if the typings or types field is not a string in the package.json',
() => {
loadTestFiles([
{
@ -202,7 +202,7 @@ runInEachFileSystem(() => {
const entryPoint = getEntryPointInfo(
fs, config, new MockLogger(), SOME_PACKAGE,
_('/project/node_modules/some_package/typings_array'));
expect(entryPoint).toBe(INVALID_ENTRY_POINT);
expect(entryPoint).toBe(INCOMPATIBLE_ENTRY_POINT);
});
for (let prop of SUPPORTED_FORMAT_PROPERTIES) {
@ -359,7 +359,7 @@ runInEachFileSystem(() => {
});
});
it('should return `INVALID_ENTRY_POINT` if the package.json is not valid JSON', () => {
it('should return `INCOMPATIBLE_ENTRY_POINT` if the package.json is not valid JSON', () => {
loadTestFiles([
// package.json might not be a valid JSON
// for example, @schematics/angular contains a package.json blueprint
@ -373,7 +373,7 @@ runInEachFileSystem(() => {
const entryPoint = getEntryPointInfo(
fs, config, new MockLogger(), SOME_PACKAGE,
_('/project/node_modules/some_package/unexpected_symbols'));
expect(entryPoint).toBe(INVALID_ENTRY_POINT);
expect(entryPoint).toBe(INCOMPATIBLE_ENTRY_POINT);
});
});
@ -395,7 +395,7 @@ runInEachFileSystem(() => {
const result = getEntryPointInfo(
fs, config, new MockLogger(), SOME_PACKAGE,
_('/project/node_modules/some_package/valid_entry_point'));
if (result === NO_ENTRY_POINT || result === INVALID_ENTRY_POINT) {
if (result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT) {
return fail(`Expected an entry point but got ${result}`);
}
entryPoint = result;

View File

@ -9,7 +9,7 @@ import {FileSystem, absoluteFrom, getFileSystem} from '../../../src/ngtsc/file_s
import {runInEachFileSystem} from '../../../src/ngtsc/file_system/testing';
import {loadTestFiles} from '../../../test/helpers';
import {NgccConfiguration} from '../../src/packages/configuration';
import {EntryPoint, EntryPointFormat, EntryPointJsonProperty, INVALID_ENTRY_POINT, NO_ENTRY_POINT, getEntryPointInfo} from '../../src/packages/entry_point';
import {EntryPoint, EntryPointFormat, EntryPointJsonProperty, INCOMPATIBLE_ENTRY_POINT, NO_ENTRY_POINT, getEntryPointInfo} from '../../src/packages/entry_point';
import {EntryPointBundle, makeEntryPointBundle} from '../../src/packages/entry_point_bundle';
import {FileWriter} from '../../src/writing/file_writer';
import {NewEntryPointFileWriter} from '../../src/writing/new_entry_point_file_writer';
@ -108,7 +108,7 @@ runInEachFileSystem(() => {
const config = new NgccConfiguration(fs, _('/'));
const result = getEntryPointInfo(
fs, config, logger, _('/node_modules/test'), _('/node_modules/test')) !;
if (result === NO_ENTRY_POINT || result === INVALID_ENTRY_POINT) {
if (result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT) {
return fail(`Expected an entry point but got ${result}`);
}
entryPoint = result;
@ -248,7 +248,7 @@ runInEachFileSystem(() => {
const config = new NgccConfiguration(fs, _('/'));
const result = getEntryPointInfo(
fs, config, logger, _('/node_modules/test'), _('/node_modules/test/a')) !;
if (result === NO_ENTRY_POINT || result === INVALID_ENTRY_POINT) {
if (result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT) {
return fail(`Expected an entry point but got ${result}`);
}
entryPoint = result;
@ -377,7 +377,7 @@ runInEachFileSystem(() => {
const config = new NgccConfiguration(fs, _('/'));
const result = getEntryPointInfo(
fs, config, new MockLogger(), _('/node_modules/test'), _('/node_modules/test/b')) !;
if (result === NO_ENTRY_POINT || result === INVALID_ENTRY_POINT) {
if (result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT) {
return fail(`Expected an entry point but got ${result}`);
}
entryPoint = result;