fix(core): enable intelligent tsconfig changes in tsconfig.base.json (#3768)

This commit is contained in:
Jason Jean 2020-09-19 12:23:54 -04:00 committed by GitHub
parent 66038891ec
commit c2a1946fe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 270 additions and 264 deletions

View File

@ -37,7 +37,10 @@ describe('getTouchedProjectsFromTsConfig', () => {
},
};
});
it('should not return changes when tsconfig.json is not touched', () => {
['tsconfig.json', 'tsconfig.base.json'].forEach((tsConfig) => {
describe(`(${tsConfig})`, () => {
it(`should not return changes when ${tsConfig} is not touched`, () => {
const result = getTouchedProjectsFromTsConfig(
[
{
@ -65,7 +68,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () => [new WholeFileChange()],
@ -85,7 +88,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () =>
@ -117,7 +120,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () =>
@ -149,7 +152,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () =>
@ -183,7 +186,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () =>
@ -215,7 +218,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () =>
@ -252,7 +255,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () =>
@ -287,7 +290,7 @@ describe('getTouchedProjectsFromTsConfig', () => {
const result = getTouchedProjectsFromTsConfig(
[
{
file: 'tsconfig.json',
file: tsConfig,
ext: '.json',
hash: 'some-hash',
getChanges: () =>
@ -318,4 +321,6 @@ describe('getTouchedProjectsFromTsConfig', () => {
expect(result).toContainEqual('proj2');
});
});
});
});
});

View File

@ -14,7 +14,8 @@ export const getTouchedProjectsFromTsConfig: TouchedProjectLocator<
WholeFileChange | JsonChange
> = (touchedFiles, _a, _b, _c, graph): string[] => {
const tsConfigJsonChanges = touchedFiles.find(
(change) => change.file === 'tsconfig.json'
(change) =>
change.file === 'tsconfig.json' || change.file === 'tsconfig.base.json'
);
if (!tsConfigJsonChanges) {
return [];