Skip to content

Commit 5ddfa8b

Browse files
committed
chore(cli): lint test files
1 parent 302f9bc commit 5ddfa8b

22 files changed

+101
-87
lines changed

.projenrc.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,8 @@ const cli = configureProject(
10021002
'@types/sinon',
10031003
'@types/yargs@^15',
10041004
'aws-cdk-lib',
1005+
'aws-sdk-client-mock',
1006+
'aws-sdk-client-mock-jest',
10051007
'axios',
10061008
'constructs',
10071009
'fast-check',
@@ -1097,7 +1099,7 @@ const cli = configureProject(
10971099
},
10981100
eslintOptions: {
10991101
dirs: ['lib'],
1100-
ignorePatterns: ['*.template.ts', '*.d.ts', 'test/**/*.ts'],
1102+
ignorePatterns: ['*.template.ts', '*.d.ts'],
11011103
},
11021104
jestOptions: jestOptionsForProject({
11031105
jestConfig: {
@@ -1144,6 +1146,7 @@ cli.eslint?.addOverride({
11441146
files: ['./test/**'],
11451147
rules: {
11461148
'@cdklabs/no-throw-default-error': 'off',
1149+
'@typescript-eslint/unbound-method': 'off',
11471150
},
11481151
});
11491152

packages/aws-cdk/.eslintrc.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/aws-cdk/.projen/deps.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/aws-cdk/.projen/tasks.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/aws-cdk/package.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/aws-cdk/test/_helpers/assembly.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import * as path from 'path';
33
import { ArtifactMetadataEntryType, ArtifactType, type AssetManifest, type AssetMetadataEntry, type AwsCloudFormationStackProperties, type MetadataEntry, type MissingContext } from '@aws-cdk/cloud-assembly-schema';
44
import { type CloudAssembly, CloudAssemblyBuilder, type CloudFormationStackArtifact, type StackMetadata } from '@aws-cdk/cx-api';
55
import { cxapiAssemblyWithForcedVersion } from './assembly-versions';
6-
import { MockSdkProvider } from '../_helpers/mock-sdk';
7-
import { CloudExecutable } from '../../lib/cxapp/cloud-executable';
8-
import { Configuration } from '../../lib/cli/user-configuration';
96
import { TestIoHost } from './io-host';
10-
import { IIoHost } from '../../lib/cli/io-host';
117
import { asIoHelper } from '../../../@aws-cdk/toolkit-lib/lib/api/io/private';
8+
import type { IIoHost } from '../../lib/cli/io-host';
9+
import { Configuration } from '../../lib/cli/user-configuration';
10+
import { CloudExecutable } from '../../lib/cxapp/cloud-executable';
11+
import { MockSdkProvider } from '../_helpers/mock-sdk';
1212

1313
export const DEFAULT_FAKE_TEMPLATE = { No: 'Resources' };
1414

@@ -47,7 +47,7 @@ export class MockCloudExecutable extends CloudExecutable {
4747
const configuration = new Configuration();
4848
const sdkProvider = sdkProviderArg ?? new MockSdkProvider();
4949
const mockIoHost = ioHost ?? new TestIoHost();
50-
50+
5151
super({
5252
configuration,
5353
sdkProvider,

packages/aws-cdk/test/_helpers/fake-io-host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IIoHost, IoMessage, IoMessageLevel, IoRequest } from "../../../@aws-cdk/toolkit-lib/lib/api/io";
1+
import type { IIoHost, IoMessage, IoMessageLevel, IoRequest } from '../../../@aws-cdk/toolkit-lib/lib/api/io';
22

33
/**
44
* An implementation of `IIoHost` that records messages and lets you assert on what was logged

packages/aws-cdk/test/_helpers/jest-bufferedconsole.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* A Jest environment that buffers outputs to `console.log()` and only shows it for failing tests.
44
*/
55
import type { EnvironmentContext, JestEnvironment, JestEnvironmentConfig } from '@jest/environment';
6-
import { Circus } from '@jest/types';
6+
import type { Circus } from '@jest/types';
77
import { TestEnvironment as NodeEnvironment } from 'jest-environment-node';
88

99
interface ConsoleMessage {

packages/aws-cdk/test/_helpers/jest-setup-after-env.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ afterAll(async () => {
6363
await new Promise<void>((resolve, reject) => {
6464
const response = aft(resolve as any);
6565
if (isPromise(response)) {
66-
response.then(() => { return resolve(); }, reject);
66+
response.then(() => {
67+
return resolve();
68+
}, reject);
6769
} else {
6870
resolve();
6971
}

packages/aws-cdk/test/_helpers/mock-sdk.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import 'aws-sdk-client-mock-jest';
2-
import { Environment } from '@aws-cdk/cx-api';
2+
import type { Environment } from '@aws-cdk/cx-api';
33
import { AppSyncClient } from '@aws-sdk/client-appsync';
44
import { CloudControlClient } from '@aws-sdk/client-cloudcontrol';
5-
import { CloudFormationClient, Stack, StackStatus } from '@aws-sdk/client-cloudformation';
5+
import type { Stack } from '@aws-sdk/client-cloudformation';
6+
import { CloudFormationClient, StackStatus } from '@aws-sdk/client-cloudformation';
67
import { CloudWatchLogsClient } from '@aws-sdk/client-cloudwatch-logs';
78
import { CodeBuildClient } from '@aws-sdk/client-codebuild';
89
import { EC2Client } from '@aws-sdk/client-ec2';
@@ -19,12 +20,12 @@ import { SFNClient } from '@aws-sdk/client-sfn';
1920
import { SSMClient } from '@aws-sdk/client-ssm';
2021
import { AssumeRoleCommand, GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts';
2122
import { createCredentialChain } from '@aws-sdk/credential-providers';
22-
import { AwsCredentialIdentity } from '@smithy/types';
23+
import type { AwsCredentialIdentity } from '@smithy/types';
2324
import { mockClient } from 'aws-sdk-client-mock';
2425
import { type Account } from 'cdk-assets';
26+
import { TestIoHost } from './io-host';
2527
import { SDK, SdkProvider } from '../../lib/api/aws-auth';
2628
import { CloudFormationStack } from '../../lib/api/cloudformation';
27-
import { TestIoHost } from './io-host';
2829

2930
export const FAKE_CREDENTIALS: AwsCredentialIdentity = {
3031
accessKeyId: 'ACCESS',
@@ -98,7 +99,7 @@ export const restoreSdkMocksToDefault = () => {
9899
*/
99100
export function undoAllSdkMocks() {
100101
applyToAllMocks('restore');
101-
};
102+
}
102103

103104
function applyToAllMocks(meth: 'reset' | 'restore') {
104105
mockAppSyncClient[meth]();

0 commit comments

Comments
 (0)