Skip to content

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

Open
@tmokmss

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.

typescript: ['node -r ts-node/register {filePath}', ['^integ\\.(?!.*\\.d\\.ts$).*\\.ts$']],

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

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/integ-runnerbugThis issue is a bug.cliIssues related to the CDK CLIeffort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions