diff --git a/packages/aws-cdk/lib/notices.ts b/packages/aws-cdk/lib/notices.ts index 8976d34d..0a7d34b4 100644 --- a/packages/aws-cdk/lib/notices.ts +++ b/packages/aws-cdk/lib/notices.ts @@ -142,7 +142,7 @@ export abstract class NoticesFilter { // component can match more than one actual component for (const ands of ors) { const matched = ands.map(affected => actualComponents.filter(actual => - NoticesFilter.componentNameMatches(affected, actual) && semver.satisfies(actual.version, affected.version))); + NoticesFilter.componentNameMatches(affected, actual) && semver.satisfies(actual.version, affected.version, { includePrerelease: true }))); // For every clause in the filter we matched one or more components if (matched.every(xs => xs.length > 0)) { diff --git a/packages/aws-cdk/test/cloud-assembly-trees/experimental-module-pre-release-semver/tree.json b/packages/aws-cdk/test/cloud-assembly-trees/experimental-module-pre-release-semver/tree.json new file mode 100644 index 00000000..ecf65507 --- /dev/null +++ b/packages/aws-cdk/test/cloud-assembly-trees/experimental-module-pre-release-semver/tree.json @@ -0,0 +1,40 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "integ-idp": { + "id": "integ-idp", + "path": "integ-idp", + "children": { + "identitypool": { + "id": "identitypool", + "path": "integ-idp/identitypool", + "constructInfo": { + "fqn": "@aws-cdk/aws-cognito-identitypool-alpha.IdentityPool", + "version": "2.175.0-alpha.0", + "metadata": ["*", "*"] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} diff --git a/packages/aws-cdk/test/notices.test.ts b/packages/aws-cdk/test/notices.test.ts index cf031844..b11a125b 100644 --- a/packages/aws-cdk/test/notices.test.ts +++ b/packages/aws-cdk/test/notices.test.ts @@ -131,6 +131,19 @@ const NOTICE_FOR_APIGATEWAYV2 = { schemaVersion: '1', }; +const NOTICES_FOR_IDENTITY_POOL = { + title: 'Regression on module foobar', + issueNumber: 1234, + overview: 'Some bug description', + components: [ + { + name: "@aws-cdk/aws-cognito-identitypool-alpha.IdentityPool", + version: ">=2.74.0-alpha.0 <2.179.0-alpha.0" + } + ], + schemaVersion: '1', +} + const NOTICE_FOR_APIGATEWAY = { title: 'Regression on module foobar', issueNumber: 1234, @@ -247,6 +260,14 @@ describe(NoticesFilter, () => { expect(NoticesFilter.filter({ data: [NOTICE_FOR_APIGATEWAYV2_CFN_STAGE], cliVersion, bootstrappedEnvironments: [], outDir: path.join(__dirname, 'cloud-assembly-trees', 'experimental-module') }).map(f => f.notice)).toEqual([NOTICE_FOR_APIGATEWAYV2_CFN_STAGE]); }); + test('module with pre-release version', () => { + // doesn't matter for this test because our data only has framework notices + const cliVersion = '1.0.0'; + + // module-level match + expect(NoticesFilter.filter({ data: [NOTICES_FOR_IDENTITY_POOL], cliVersion, bootstrappedEnvironments: [], outDir: path.join(__dirname, 'cloud-assembly-trees', 'experimental-module-pre-release-semver')}).map(f => f.notice)).toEqual([NOTICES_FOR_IDENTITY_POOL]); + }); + test('bootstrap', () => { // doesn't matter for this test because our data only has bootstrap notices const outDir = path.join(__dirname, 'cloud-assembly-trees', 'built-with-2_12_0');