Skip to content

Commit 5f00685

Browse files
authored
Merge branch 'main' into mrgrain/refactor/integ-runner/remove-deprecated-cli-engine
2 parents c91da48 + c13141e commit 5f00685

File tree

6 files changed

+105
-3
lines changed

6 files changed

+105
-3
lines changed

packages/@aws-cdk/integ-runner/lib/cli.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ export function parseCliArgs(args: string[] = []) {
7979
}
8080

8181
const requestedTests = fromFile
82-
? (fs.readFileSync(fromFile, { encoding: 'utf8' })).split('\n').filter(x => x)
82+
? (fs.readFileSync(fromFile, { encoding: 'utf8' }))
83+
.split('\n')
84+
.filter(x => x)
85+
.filter(x => !x.startsWith('#'))
8386
: (tests.length > 0 ? tests : undefined); // 'undefined' means no request
8487

8588
if (argv['disable-update-workflow'] !== undefined && argv['update-workflow'] !== undefined) {

packages/@aws-cdk/integ-runner/test/cli.test.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,84 @@ describe('Test discovery', () => {
132132
});
133133
});
134134

135+
describe('--from-file comment filtering', () => {
136+
const currentCwd = process.cwd();
137+
let tempDir: string;
138+
139+
beforeEach(() => {
140+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'integ-runner-test-'));
141+
process.chdir(tempDir);
142+
});
143+
144+
afterEach(() => {
145+
process.chdir(currentCwd);
146+
fs.rmSync(tempDir, { recursive: true, force: true });
147+
});
148+
149+
test('filters out comment lines starting with #', () => {
150+
// Create temp file with mix of comments and test names
151+
const testFile = path.join(tempDir, 'tests.txt');
152+
fs.writeFileSync(testFile, [
153+
'# This is a comment',
154+
'test1.js',
155+
'# Another comment',
156+
'test2.js',
157+
'test3.js',
158+
'# Final comment',
159+
].join('\n'));
160+
161+
const options = parseCliArgs(['--from-file', testFile]);
162+
163+
// Verify comments are excluded and test names are included
164+
expect(options.tests).toEqual(['test1.js', 'test2.js', 'test3.js']);
165+
});
166+
167+
test('returns empty array for comment-only file', () => {
168+
// Create temp file with only # lines
169+
const testFile = path.join(tempDir, 'comments-only.txt');
170+
fs.writeFileSync(testFile, [
171+
'# Comment 1',
172+
'# Comment 2',
173+
'# Comment 3',
174+
].join('\n'));
175+
176+
const options = parseCliArgs(['--from-file', testFile]);
177+
178+
// Verify empty array is returned
179+
expect(options.tests).toEqual([]);
180+
});
181+
182+
test('preserves lines with # not at start (inline hash)', () => {
183+
// Create temp file with lines like test#1.js
184+
const testFile = path.join(tempDir, 'inline-hash.txt');
185+
fs.writeFileSync(testFile, [
186+
'test#1.js',
187+
'my-test#feature.js',
188+
'another#test#file.js',
189+
].join('\n'));
190+
191+
const options = parseCliArgs(['--from-file', testFile]);
192+
193+
// Verify lines with # not at start are preserved
194+
expect(options.tests).toEqual(['test#1.js', 'my-test#feature.js', 'another#test#file.js']);
195+
});
196+
197+
test('preserves lines with whitespace before # as test names', () => {
198+
// Create temp file with lines like " #not-a-comment"
199+
const testFile = path.join(tempDir, 'whitespace-hash.txt');
200+
fs.writeFileSync(testFile, [
201+
' #not-a-comment',
202+
'\t#also-not-a-comment',
203+
' #test-name',
204+
].join('\n'));
205+
206+
const options = parseCliArgs(['--from-file', testFile]);
207+
208+
// Verify lines with whitespace before # are preserved as test names
209+
expect(options.tests).toEqual([' #not-a-comment', '\t#also-not-a-comment', ' #test-name']);
210+
});
211+
});
212+
135213
describe('CLI config file', () => {
136214
const configFile = 'integ.config.json';
137215
const withConfig = (settings: any, fileName = configFile) => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"aws-cdk-lib": "^2.236.0", "constructs": "^10.0.0"}
1+
{"aws-cdk-lib": "^2.237.0", "constructs": "^10.0.0"}

packages/aws-cdk/lib/init-templates/.recommended-feature-flags.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": true,
5050
"@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": true,
5151
"@aws-cdk/aws-eks:nodegroupNameAttribute": true,
52+
"@aws-cdk/aws-eks:useNativeOidcProvider": true,
5253
"@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true,
5354
"@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true,
5455
"@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false,

packages/aws-cdk/package.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.

yarn.lock

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

0 commit comments

Comments
 (0)