From a90c06cad3547632a9f881216380fd35339592f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier?= Date: Tue, 13 Jun 2023 14:25:43 +0200 Subject: [PATCH] change default test behavior to ignore deprecations --- packages/@aws-cdk/region-info/test/default.test.ts | 2 -- packages/@aws-cdk/region-info/test/fact.test.ts | 2 -- packages/@aws-cdk/region-info/test/region-info.test.ts | 2 -- packages/cdk-cli-wrapper/test/cdk-wrapper.test.ts | 2 -- tools/@aws-cdk/cdk-build-tools/bin/cdk-test.ts | 4 +--- .../@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts | 2 +- .../fixtures/invalid-cfn-imports/cfn-constructor.error.txt | 1 - .../rules/fixtures/invalid-cfn-imports/cfn-constructor.ts | 3 --- .../reference-cfn-construct-on-barrel-import.error.txt | 2 -- .../reference-cfn-construct-on-barrel-import.ts | 5 ----- tools/@aws-cdk/node-bundle/test/cli.test.ts | 2 +- 11 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.error.txt delete mode 100644 tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.ts delete mode 100644 tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.error.txt delete mode 100644 tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.ts diff --git a/packages/@aws-cdk/region-info/test/default.test.ts b/packages/@aws-cdk/region-info/test/default.test.ts index 3f3e8276674a2..b9c7a4375f8fd 100644 --- a/packages/@aws-cdk/region-info/test/default.test.ts +++ b/packages/@aws-cdk/region-info/test/default.test.ts @@ -1,7 +1,5 @@ import { Default } from '../lib'; -process.env.JSII_DEPRECATED = 'quiet'; - const region = 'bermuda-triangle-42'; const urlSuffix = '.nowhere.null'; diff --git a/packages/@aws-cdk/region-info/test/fact.test.ts b/packages/@aws-cdk/region-info/test/fact.test.ts index 0c1942b217ae0..b3e3bab7fdab7 100644 --- a/packages/@aws-cdk/region-info/test/fact.test.ts +++ b/packages/@aws-cdk/region-info/test/fact.test.ts @@ -1,8 +1,6 @@ import { Fact, FactName } from '../lib'; import { AWS_REGIONS } from '../lib/aws-entities'; -process.env.JSII_DEPRECATED = 'quiet'; - describe('find', () => { test('returns undefined for an unknown fact', () => { expect(Fact.find(AWS_REGIONS[0], 'not:a:known:fact')).toBe(undefined); diff --git a/packages/@aws-cdk/region-info/test/region-info.test.ts b/packages/@aws-cdk/region-info/test/region-info.test.ts index d3ca1725874bc..a47e8829ad9f5 100644 --- a/packages/@aws-cdk/region-info/test/region-info.test.ts +++ b/packages/@aws-cdk/region-info/test/region-info.test.ts @@ -2,8 +2,6 @@ import { CLOUDWATCH_LAMBDA_INSIGHTS_ARNS } from '../build-tools/fact-tables'; import { FactName, RegionInfo } from '../lib'; import { AWS_REGIONS, AWS_SERVICES } from '../lib/aws-entities'; -process.env.JSII_DEPRECATED = 'quiet'; - test('built-in data is correct', () => { const snapshot: any = {}; for (const name of AWS_REGIONS) { diff --git a/packages/cdk-cli-wrapper/test/cdk-wrapper.test.ts b/packages/cdk-cli-wrapper/test/cdk-wrapper.test.ts index 2d8dc1b7f27ea..0a9d370426aae 100644 --- a/packages/cdk-cli-wrapper/test/cdk-wrapper.test.ts +++ b/packages/cdk-cli-wrapper/test/cdk-wrapper.test.ts @@ -4,8 +4,6 @@ import { RequireApproval } from '../lib/commands'; let spawnSyncMock: jest.SpyInstance; beforeEach(() => { - process.env.JSII_DEPRECATED = 'silent'; - spawnSyncMock = jest.spyOn(child_process, 'spawnSync').mockReturnValue({ status: 0, stderr: Buffer.from('stderr'), diff --git a/tools/@aws-cdk/cdk-build-tools/bin/cdk-test.ts b/tools/@aws-cdk/cdk-build-tools/bin/cdk-test.ts index 09d0cf359e309..9ffd2129cf28c 100644 --- a/tools/@aws-cdk/cdk-build-tools/bin/cdk-test.ts +++ b/tools/@aws-cdk/cdk-build-tools/bin/cdk-test.ts @@ -35,9 +35,7 @@ async function main() { env: { ...defaultShellOptions.env, - // by default, fail when deprecated symbols are used in tests. - // tests that verify behaviour of deprecated symbols must use the `testDeprecated()` API. - JSII_DEPRECATED: 'fail', + JSII_DEPRECATED: 'quiet', }, }; diff --git a/tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts b/tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts index 289b987eedb04..c7811ede3fa61 100644 --- a/tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts +++ b/tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts @@ -151,7 +151,7 @@ function isAlphaPackage(packageDir: string): boolean { } const maturity = pkg.maturity; - if (maturity !== 'experimental' && maturity !== 'developer-preview' && maturity !== 'deprecated') { + if (maturity !== 'experimental' && maturity !== 'developer-preview') { return false; } // we're only interested in '@aws-cdk/' packages, diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.error.txt deleted file mode 100644 index 121e27ffe48eb..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.error.txt +++ /dev/null @@ -1 +0,0 @@ -To allow rewriting imports when generating v2 experimental packages, `CfnDeliveryStream` must be imported by name and separate from non-L1 imports, since it is being imported from an experimental package: @aws-cdk/aws-kinesisfirehose \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.ts deleted file mode 100644 index 2039b80f725e4..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as firehose from '@aws-cdk/aws-kinesisfirehose'; - -const x = new firehose.CfnDeliveryStream(scope, 'id'); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.error.txt deleted file mode 100644 index e84d51be542ea..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.error.txt +++ /dev/null @@ -1,2 +0,0 @@ -To allow rewriting imports when generating v2 experimental packages, `CfnTable` must be imported by name from its specific .generated location. -To allow rewriting imports when generating v2 experimental packages, `CfnDeliveryStream` must be imported by name and separate from non-L1 imports, since it is being imported from an experimental package: @aws-cdk/aws-kinesisfirehose \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.ts deleted file mode 100644 index 1345c54aba549..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as firehose from '@aws-cdk/aws-kinesisfirehose'; -import * as glue from '../lib'; - -let x: firehose.CfnDeliveryStream.CloudWatchLoggingOptionsProperty; -let y: glue.CfnTable; \ No newline at end of file diff --git a/tools/@aws-cdk/node-bundle/test/cli.test.ts b/tools/@aws-cdk/node-bundle/test/cli.test.ts index 19f1ed22500dc..a41922d59d02e 100644 --- a/tools/@aws-cdk/node-bundle/test/cli.test.ts +++ b/tools/@aws-cdk/node-bundle/test/cli.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import * as fs from 'fs-extra'; -import { shell } from '../src/api/_shell'; import { Package } from './_package'; +import { shell } from '../src/api/_shell'; test('validate', () => {