Skip to content

Commit 29ebf70

Browse files
committed
feat(integ-runner): use toolkit-lib as default engine
1 parent 05954dd commit 29ebf70

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

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

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function parseCliArgs(args: string[] = []) {
5050
})
5151
.option('app', { type: 'string', default: undefined, desc: 'The custom CLI command that will be used to run the test files. You can include {filePath} to specify where in the command the test file path should be inserted. Example: --app="python3.8 {filePath}".' })
5252
.option('test-regex', { type: 'array', desc: 'Detect integration test files matching this JavaScript regex pattern. If used multiple times, all files matching any one of the patterns are detected.', default: [] })
53-
.option('unstable', { type: 'array', desc: 'Opt-in to using unstable features. By using this flags acknowledges that the scope and API of the feature may change without notice. Specify multiple times for each unstable feature you want to opt-in to.', nargs: 1, choices: ['toolkit-lib-engine'], default: [] })
53+
.option('unstable', { type: 'array', desc: 'Opt-in to using unstable features. By using these flags you acknowledges that scope and APIs of unstable features may change without notice. Specify multiple times for each unstable feature you want to opt-in to.', nargs: 1, choices: ['toolkit-lib-engine', 'deprecated-cli-engine'], default: [] })
5454
.strict()
5555
.parse(args);
5656

@@ -102,9 +102,22 @@ export function parseCliArgs(args: string[] = []) {
102102
}
103103

104104
export async function main(args: string[]) {
105-
const options = parseCliArgs(args);
106-
const engine = engineFromOptions(options).engine;
105+
let engineForError;
106+
try {
107+
const options = parseCliArgs(args);
108+
const engine = engineFromOptions(options);
109+
engineForError = engine.engine;
110+
await run(options, engine);
111+
} catch (err: any) {
112+
logger.error(err);
113+
if (engineForError === 'toolkit-lib') {
114+
logger.warning('[Notice] You are using the new default engine to execute integration tests. If you think the above error may be caused by the new engine, you can choose to temporarily revert to the previous engine by adding the `--unstable=deprecated-cli-engine` option. Please note that this engine is deprecated and scheduled to be removed in January 2026.\n\nIf reverting to the old engine resolves an issue for you, please let us know so we can address any issues with the new engine. Report issues here: <TODO>');
115+
}
116+
throw err;
117+
}
118+
}
107119

120+
async function run(options: ReturnType<typeof parseCliArgs>, { engine }: EngineOptions) {
108121
const testsFromArgs = await new IntegrationTests(path.resolve(options.directory)).fromCliOptions(options);
109122

110123
// List only prints the discovered tests
@@ -285,8 +298,7 @@ function mergeTests(testFromArgs: IntegTestInfo[], failedSnapshotTests: IntegTes
285298
}
286299

287300
export function cli(args: string[] = process.argv.slice(2)) {
288-
main(args).then().catch(err => {
289-
logger.error(err);
301+
main(args).then().catch(() => {
290302
process.exitCode = 1;
291303
});
292304
}
@@ -308,9 +320,10 @@ function configFromFile(fileName?: string): Record<string, any> {
308320
}
309321
}
310322

311-
function engineFromOptions(options: { unstable?: string[] }): EngineOptions {
312-
if (options.unstable?.includes('toolkit-lib-engine')) {
313-
return { engine: 'toolkit-lib' };
323+
function engineFromOptions(options: { unstable?: string[] }): Required<EngineOptions> {
324+
if (options.unstable?.includes('deprecated-cli-engine')) {
325+
logger.warning('[Deprecation Notice] You have opted-in to use the deprecated CLI engine which is scheduled to be removed in January 2026. If you have encountered any blockers to use the new default engine, please let us know by opening an issue: <TODO>\n\nTo use the new default engine, please remove the `--unstable=deprecated-cli-engine` option.');
326+
return { engine: 'cli-wrapper' };
314327
}
315-
return { engine: 'cli-wrapper' };
328+
return { engine: 'toolkit-lib' };
316329
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ afterAll(() => {
2323
});
2424

2525
describe.each([
26-
['cli-wrapper', []],
27-
['toolkit-lib', ['--unstable', 'toolkit-lib-engine']],
26+
['cli-wrapper', ['--unstable', 'deprecated-cli-engine']],
27+
['toolkit-lib', []],
28+
// ['toolkit-lib', ['--unstable', 'toolkit-lib-engine']],
2829
])('Test discovery with engine %s', (_engine: string, engineArgs: string[]) => {
2930
const currentCwd = process.cwd();
3031
beforeAll(() => {

0 commit comments

Comments
 (0)