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
chore(cli): update tests for future monorepo (#32185)
A number of our tests depend on the version of the `cloud-assembly-schema`, and some of our tests use `aws-cdk-lib` to generate Cloud Assemblies which has its own copy of `cloud-assembly-schema` built in.
Because `cloud-assembly-schema` currently takes its schema version from its `package.json` version, and because the version of `cloud-assembly-schema/package.json` will be `0.0.0` once it has been moved into our new monorepo, these tests need to be changed to deal with this situation.
The solution we're currently taking is to rewrite `manifest.json` and change the `version` in there to a different one.
This PR also renames `expect(...).toBeCalledWith()` to `expect(...).toHaveBeenCalledWith()` because the jest linter requires is.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
* The cloud-assembly-schema in the new monorepo will use its own package version as the schema version, which is always `0.0.0` when tests are running.
7
+
*
8
+
* If we want to test the CLI's behavior when presented with specific schema versions, we will have to
9
+
* mutate `manifest.json` on disk after writing it, and write the schema version that we want to test for in there.
10
+
*
11
+
* After we raise the schema version in the file on disk from `0.0.0` to
12
+
* `30.0.0`, `cx-api` will refuse to load `manifest.json` back, because the
13
+
* version is higher than its own package version ("Maximum schema version
14
+
* supported is 0.x.x, but found 30.0.0"), so we have to turn on `skipVersionCheck`.
constexpectedError='This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version.'
80
83
+`\n(Cloud assembly schema version mismatch: Maximum schema version supported is ${semver.major(currentSchemaVersion)}.x.x, but found ${mockManifestVersion})`;
81
84
@@ -90,20 +93,31 @@ test('cli does not throw when manifest version = schema version', async () => {
0 commit comments