Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] ci: fix dedupe-duplicate-modules flakes #18007

Merged
merged 1 commit into from Jun 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 24 additions & 18 deletions tests/legacy-cli/e2e/tests/misc/dedupe-duplicate-modules.ts
Expand Up @@ -4,20 +4,20 @@ import { updateJsonFile } from '../../utils/project';
import { expectToFail } from '../../utils/utils';

export default async function () {
// Force duplicate modules
await updateJsonFile('package.json', json => {
json.dependencies = {
...json.dependencies,
'tslib': '2.0.0',
'tslib-1': 'npm:tslib@1.13.0',
'tslib-1-copy': 'npm:tslib@1.13.0',
};
});
// Force duplicate modules
await updateJsonFile('package.json', json => {
json.dependencies = {
...json.dependencies,
'tslib': '2.0.0',
'tslib-1': 'npm:tslib@1.13.0',
'tslib-1-copy': 'npm:tslib@1.13.0',
};
});

await silentNpm('install');
await silentNpm('install');

await writeFile('./src/main.ts',
`
await writeFile('./src/main.ts',
`
import { __assign as __assign_0 } from 'tslib';
import { __assign as __assign_1 } from 'tslib-1';
import { __assign as __assign_2 } from 'tslib-1-copy';
Expand All @@ -29,13 +29,19 @@ export default async function () {
})
`);

const { stderr } = await ng('build', '--verbose', '--no-vendor-chunk', '--no-progress');
if (!/\[DedupeModuleResolvePlugin\]:.+tslib-1-copy -> .+tslib-1/.test(stderr)) {
throw new Error('Expected stderr to contain [DedupeModuleResolvePlugin] log for tslib.');
}
const { stderr } = await ng('build', '--verbose', '--no-vendor-chunk', '--no-progress');
const outFile = 'dist/test-project/main.js';

const outFile = 'dist/test-project/main.js';
await expectFileToMatch(outFile, './node_modules/tslib/tslib.es6.js');
if (/\[DedupeModuleResolvePlugin\]:.+tslib-1-copy -> .+tslib-1/.test(stderr)) {
await expectFileToMatch(outFile, './node_modules/tslib-1/tslib.es6.js');
await expectToFail(() => expectFileToMatch(outFile, './node_modules/tslib-1-copy/tslib.es6.js'));
} else if (/\[DedupeModuleResolvePlugin\]:.+tslib-1 -> .+tslib-1-copy/.test(stderr)) {
await expectFileToMatch(outFile, './node_modules/tslib-1-copy/tslib.es6.js');
await expectToFail(() => expectFileToMatch(outFile, './node_modules/tslib-1/tslib.es6.js'));
} else {
console.error(`\n\n\n${stderr}\n\n\n`);
throw new Error('Expected stderr to contain [DedupeModuleResolvePlugin] log for tslib.');
}

await expectFileToMatch(outFile, './node_modules/tslib/tslib.es6.js');
}