test(ngcc): cleanup entry-point bundle testcases (#34415)

There was an issue with the program under test and two tests with the
same description, this has been fixed.

PR Close #34415
This commit is contained in:
JoostK 2019-12-14 22:35:00 +01:00 committed by Kara Erickson
parent a186dbc1d4
commit 12444a8afc
1 changed files with 69 additions and 68 deletions

View File

@ -134,7 +134,7 @@ runInEachFileSystem(() => {
{name: _('/node_modules/internal/src/index.d.ts'), contents: ''}, {name: _('/node_modules/internal/src/index.d.ts'), contents: ''},
{ {
name: _('/node_modules/internal/src/internal.d.ts'), name: _('/node_modules/internal/src/internal.d.ts'),
contents: 'export declare function internal();' contents: 'export declare class Internal {}'
}, },
{ {
name: _('/node_modules/internal/esm2015/index.js'), name: _('/node_modules/internal/esm2015/index.js'),
@ -146,7 +146,7 @@ runInEachFileSystem(() => {
}, },
{ {
name: _('/node_modules/internal/esm2015/src/internal.js'), name: _('/node_modules/internal/esm2015/src/internal.js'),
contents: 'export function internal();' contents: 'export class Internal {}'
}, },
// A package with a secondary entry-point that has source files in a different tree // A package with a secondary entry-point that has source files in a different tree
@ -210,8 +210,10 @@ runInEachFileSystem(() => {
].map(p => absoluteFrom(p).toString()))); ].map(p => absoluteFrom(p).toString())));
}); });
it('should include equivalently named, internally imported, src files in the typings program, if `mirrorDtsFromSrc` is true', describe(
'including equivalently named, internally imported, src files in the typings program',
() => { () => {
it('does include internal .d.ts files if `mirrorDtsFromSrc` is true', () => {
setupMockFileSystem(); setupMockFileSystem();
const fs = getFileSystem(); const fs = getFileSystem();
const entryPoint: EntryPoint = { const entryPoint: EntryPoint = {
@ -233,8 +235,7 @@ runInEachFileSystem(() => {
.toContain(absoluteFrom('/node_modules/test/internal.d.ts')); .toContain(absoluteFrom('/node_modules/test/internal.d.ts'));
}); });
it('should include equivalently named, internally imported, src files in the typings program, if `mirrorDtsFromSrc` is true', it('should work when the .d.ts files are in a different tree than the sources', () => {
() => {
setupMockFileSystem(); setupMockFileSystem();
const fs = getFileSystem(); const fs = getFileSystem();
const entryPoint: EntryPoint = { const entryPoint: EntryPoint = {
@ -256,8 +257,7 @@ runInEachFileSystem(() => {
.toContain(absoluteFrom('/node_modules/internal/src/internal.d.ts')); .toContain(absoluteFrom('/node_modules/internal/src/internal.d.ts'));
}); });
it('should ignore, internally imported, src files in the typings program, if `mirrorDtsFromSrc` is false', it('ignores internal .d.ts files if `mirrorDtsFromSrc` is false', () => {
() => {
setupMockFileSystem(); setupMockFileSystem();
const fs = getFileSystem(); const fs = getFileSystem();
const entryPoint: EntryPoint = { const entryPoint: EntryPoint = {
@ -278,6 +278,7 @@ runInEachFileSystem(() => {
expect(esm5bundle.dts !.program.getSourceFiles().map(sf => sf.fileName)) expect(esm5bundle.dts !.program.getSourceFiles().map(sf => sf.fileName))
.not.toContain(absoluteFrom('/node_modules/test/internal.d.ts')); .not.toContain(absoluteFrom('/node_modules/test/internal.d.ts'));
}); });
});
it('should set the `rootDir` to the package path not the entry-point path', () => { it('should set the `rootDir` to the package path not the entry-point path', () => {
setupMockFileSystem(); setupMockFileSystem();