Skip to content

Commit 7b7294c

Browse files
authored
chore(cli): integ test current version against all supported versions of TS (#23244)
We currently only test against a single TS version as defined in the init-templates. This change will run these tests against all supported TS minor versions (currently `typescript@>=3.9`). A recent change on main that broke support for >=TS4.0 went undetected due to missing these tests. Tests are about 2min per TS version, with a total of 11 supported versions, these tests will now take 22min instead of 2min. Other actions in the same pipeline stage take 25min and over 50min (docs), so this shouldn't have an effect on total pipeline runtime. ~This PR is based off and tested with the last released version (v2.53.0), as `main` is currently not building.~ ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-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)? * [ ] 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*
1 parent 3951f09 commit 7b7294c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
#------------------------------------------------------------------
3+
# setup
4+
#------------------------------------------------------------------
5+
set -eu
6+
scriptdir=$(cd $(dirname $0) && pwd)
7+
integdir=$(dirname $scriptdir)
8+
source ${scriptdir}/common.bash
9+
10+
header TypeScript Versions
11+
12+
#------------------------------------------------------------------
13+
14+
MIN_SUPPORTED_TS_VERSION=${1:-"3.9"}
15+
SUPPORTED_TS_VERSIONS=$(node ${integdir}/typescript-versions.js ${MIN_SUPPORTED_TS_VERSION})
16+
17+
for version in $SUPPORTED_TS_VERSIONS; do
18+
echo "Testing against TypeScript v$version"
19+
20+
setup
21+
22+
cdk init -l typescript sample-app --generate-only
23+
npm pkg delete devDependencies
24+
npm install --save-dev typescript@$version
25+
npm prune && npm ls
26+
rm test/*
27+
npm run build
28+
cdk synth
29+
done
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { spawnSync } from 'child_process';
2+
3+
const minSupportedVersion = process.argv.slice(2, 3);
4+
5+
const { stdout } = spawnSync('npm', ['--silent', 'view', `typescript@>=${minSupportedVersion}`, 'version', '--json']);
6+
7+
const versions: string[] = JSON.parse(stdout);
8+
const minorVersions = Array.from(new Set(versions.map(v => v.split('.').slice(0, 2).join('.'))));
9+
10+
process.stdout.write(minorVersions.join(' '));

0 commit comments

Comments
 (0)