Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integ-runner: --watch flag creates a cdk.context.json with watch field #30485

Open
dontirun opened this issue Jun 7, 2024 · 4 comments
Open
Labels
@aws-cdk/integ-runner bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@dontirun
Copy link
Contributor

dontirun commented Jun 7, 2024

Describe the bug

integ runner creates a cdk.context.json file with the watch field if the the context file does not exist, when it actually needs a cdk.json with the watch field.

Expected Behavior

Create a cdk.json with the watch field if it doesn't exist

Current Behavior

integ runner creates a cdk.context.json file with the watch field if the the context file does not exist

Reproduction Steps

  1. Create a new application
mkdir bug
cdk init app --language=typescript
  1. Add integ-runner and integ-tests-alpha to the package.json
  "dependencies": {
    "aws-cdk-lib": "2.144.0",
    "constructs": "^10.0.0",
    "@aws-cdk/integ-runner": "2.144.0-alpha.0",
    "@aws-cdk/integ-tests-alpha": "2.144.0-alpha.0",
    "source-map-support": "^0.5.21"
  }
}
  1. npm install
  2. create the following test/integ.example.test.ts file
import * as integ from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { Construct } from "constructs";

const app = new cdk.App();

class TestStack extends cdk.Stack {
  constructor(scope: Construct, id: string) {
    super(scope, id);
    new cdk.CfnWaitConditionHandle(this, 'NullResource');
  }
}
const stack = new TestStack(app, 'TestStack');
new integ.IntegTest(app, 'integration-test', {
  testCases: [stack],
});
  1. Optional: delete the cdk.json file (doesn't matter)
  2. npx integ-runner test/integ.example.test.ts --watch

Possible Solution

  1. Don't create a cdk.context.json
  2. create a /update the existing cdk.json with the watch field

Additional Information/Context

The documentation needs to be update to reflect this

CDK CLI Version

2.144.0 (build 5fb15bc)

Framework Version

No response

Node.js Version

v18.15.0

OS

Osx

Language

TypeScript

Language Version

No response

Other information

No response

@dontirun dontirun added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 7, 2024
@karmabadger
Copy link

@dontirun what's the content of the cdk.context.json? I feel like it's for a different purpose than the cdk.json.
I'm pretty sure cdk allows you to run without a cdk.json as long as you give it a --app so you can run it without having to be in a project directory. So in that sense I'm not sure if it makes sense necessarily to have a cdk.json autogenerated?

@dontirun
Copy link
Contributor Author

dontirun commented Jun 8, 2024

It just has the watch property and nothing else. The watch property should be in the cdk.json

@karmabadger
Copy link

It just has the watch property and nothing else. The watch property should be in the cdk.json

yeah that seems a bit weird.

@pahud
Copy link
Contributor

pahud commented Jun 13, 2024

Yes it does create cdk.context.json with an empty watch. Looks like a bug to me.

{
  "watch": {}
}

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/integ-runner bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

3 participants