aws / aws/aws-cdk

integ-runner: integ-runner implictly depends on ts-node

Open
#23,710 9 comments 3 reactions 0 assignees View on GitHub
@aws-cdk/integ-runner bug cli effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Hi, I found a tiny minor issue regarding integ-runner. It'd be great if you check it when you get a chance.

Starting from 2.60.0 (#22058), it seems @aws-cdk/integ-runner implicitly depends on ts-node.

https://github.com/aws/aws-cdk/blob/aca8a256dcaf89b53f7af4f308b2f23e2e766902/packages/%40aws-cdk/integ-runner/lib/runner/integration-tests.ts#L251

Without ts-node, the error below happens:

```
$ yarn integ-runner --update-on-failed
yarn run v1.22.17
Verifying integration test snapshots...

node:internal/modules/cjs/loader:988
throw err;
^

Error: Cannot find module 'ts-node/register'
Require stack:
- internal/preload
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at Module._preloadModules (node:internal/modules/cjs/loader:1332:12)
at loadPreloadModules (node:internal/bootstrap/pre_execution:583:5)
at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:95:3)
at node:internal/main/run_main_module:9:1 {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'internal/preload' ]
}
ERROR integ.nodejs-build 0.088s
Command exited with status 1
```

As for usual CDK apps, ts-node is installed by default so it shouldn't be a big problem. In CDK construct library templates generated by projen, however, ts-node is not installed by default so this library behaves somewhat confusing.
Isn't it be more clear if it is explicitly specified in package.json of integ-runner as peerDependency or Dependency?

### Expected Behavior

When installing @aws-cdk/integ-runner, ts-node is installed automatically or at least suggested as a peer dependency.

It will help us a lot if there is more clear way to know the requirements of ts-node, or it is installed automatically.

### Current Behavior

We get an error without ts-node. Also we need to carefully inspect the error and manually install ts-node.

### Reproduction Steps

Use integ-runner for `*integ.ts` files without installing ts-node.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.60.0

### Framework Version

2.60.0

### Node.js Version

v16.18.1

### OS

macOS

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at packages/@aws-cdk/integ-runner/lib/runner/integration-tests.ts around line 251 and inspect the @aws-cdk/integ-runner package metadata for how ts-node is expected to be provided. Reproduce with an integ.ts file and no ts-node installed, then verify that installation either supplies the dependency automatically or clearly communicates the requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.