You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(integ-runner): support --language presets for JavaScript, TypeScript, Python and Go (#22058)
It was already possible to run tests in any language by providing `--app` and `--test-regex` directly.
This change introduces the concept of language presets that can be selected.
By default all supported languages will be detected.
Users can run integration tests for multiple languages at the same time, using the default preset configuration.
To further customize anything, only a single language can be selected. However it's always possible to call the `integ-runner` multiple times:
```console
integ-runner --language typescript
integ-runner --language python --app="python3.2"
integ-runner --language go --test-regex=".*\.integ\.go"
```
Resolves part of #21169
----
### All Submissions:
* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)
### Adding new Unconventional Dependencies:
* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)
### New Features
* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardExpand all lines: packages/@aws-cdk/integ-runner/README.md
+22-3
Original file line number
Diff line number
Diff line change
@@ -70,16 +70,35 @@ to be a self contained CDK app. The runner will execute the following for each f
70
70
If this is set to `true` then the [update workflow](#update-workflow) will be disabled
71
71
-`--app`
72
72
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}".
73
+
74
+
Use together with `--test-regex` to fully customize how tests are run, or use with a single `--language` preset to change the command used for this language.
73
75
-`--test-regex`
74
76
Detect integration test files matching this JavaScript regex pattern. If used multiple times, all files matching any one of the patterns are detected.
75
-
77
+
78
+
Use together with `--app` to fully customize how tests are run, or use with a single `--language` preset to change which files are detected for this language.
79
+
-`--language`
80
+
The language presets to use. You can discover and run tests written in multiple languages by passing this flag multiple times (`--language typescript --language python`). Defaults to all supported languages. Currently supported language presets are:
81
+
-`javascript`:
82
+
- File RegExp: `^integ\..*\.js$`
83
+
- App run command: `node {filePath}`
84
+
-`typescript`:\
85
+
Note that for TypeScript files compiled to JavaScript, the JS tests will take precedence and the TS ones won't be evaluated.
86
+
- File RegExp: `^integ\..*(?<!\.d)\.ts$`
87
+
- App run command: `node -r ts-node/register {filePath}`
This will search for integration tests recursively from the current directory and then execute them in parallel across `us-east-1`, `us-east-2`, & `us-west-2`.
101
+
This will search for python integration tests recursively from the current directory and then execute them in parallel across `us-east-1`, `us-east-2`, & `us-west-2`.
83
102
84
103
If you are providing a list of tests to execute, either as CLI arguments or from a file, the name of the test needs to be relative to the `directory`.
85
104
For example, if there is a test `aws-iam/test/integ.policy.js` and the current working directory is `aws-iam` you would provide `integ.policy.js`
desc: 'Use these presets to run integration tests for the selected languages',
44
+
})
38
45
.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}".'})
39
46
.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: []})
thrownewError(`Only a single "--language" can be used with "${option}". Alternatively provide both "--app" and "--test-regex" to fully customize the configuration.`);
0 commit comments