Skip to content

Commit d0c979e

Browse files
AndrewKushnirthePunderWoman
authored andcommitted
test(bazel): update common package contents test to skip chunks (angular#60676)
This commit updates the `common` package contents test to skip JS chunks, while still making sure that the main entrypoint files are present. PR Close angular#60676
1 parent f8ca1d5 commit d0c979e

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

packages/bazel/test/ng_package/common_package.spec.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('@angular/common ng_package', () => {
3333
});
3434

3535
it('should have right fesm files', () => {
36-
const expected = [
36+
const expectedFiles = [
3737
'common.mjs',
3838
'common.mjs.map',
3939
'http',
@@ -46,13 +46,18 @@ describe('@angular/common ng_package', () => {
4646
'upgrade.mjs',
4747
'upgrade.mjs.map',
4848
];
49-
expect(
50-
shx
51-
.ls('-R', 'fesm2022')
52-
.stdout.split('\n')
53-
.filter((n) => !!n)
54-
.sort(),
55-
).toEqual(expected);
49+
const allFiles = shx
50+
.ls('-R', 'fesm2022')
51+
.stdout.split('\n')
52+
.filter((n) => !!n)
53+
.sort();
54+
// The list of files would contain some shared chunks too (e.g. `location-CprIx2Bv.mjs`),
55+
// so we make sure that the actual list of files properly represent main entrypoints
56+
// (ignoring extra chunks info).
57+
const allFilesAsSet = new Set(allFiles);
58+
for (const expectedFile of expectedFiles) {
59+
expect(allFilesAsSet.has(expectedFile)).toBe(true);
60+
}
5661
});
5762

5863
it('should have the correct source map paths', () => {

0 commit comments

Comments
 (0)