lab-transform-typescript is a utility that enables the `lab` testing framework to directly execute TypeScript test files without requiring a separate pre-compilation step. This allows for a more streamlined `npm test` workflow for projects using TypeScript with `lab`. The current stable version is 3.0.1, which includes inlined source maps for better error reporting. The package's release cadence is not fixed, typically driven by updates to the `lab` framework or `typescript` itself. Key differentiators include its tight integration with `lab`, support for source maps, and the provision of optional type definitions for `lab` and `code` (the assertion library used with `lab`), enhancing the development experience for TypeScript users within the `lab` ecosystem. It leverages TypeScript's official configuration loader and parser since version 3.0.0.
npm install lab-transform-typescriptVerified import paths — ran on the pinned version, not inferred.
Demonstrates installation and configuration of `lab-transform-typescript` to enable direct execution of TypeScript test files using the `lab` CLI.
Review your `tsconfig.json` and ensure it's compatible with TypeScript's standard parsing. The `TSCONFIG` environment variable can be used to explicitly override the `tsconfig.json` location.
Ensure `typescript` is installed as a `devDependency` in your project (`npm install typescript --save-dev`). The version of `typescript` used will be the one from your project's `node_modules`.
There is no direct fix for this known issue (#1 in the project's issue tracker, linked to `hapijs/lab#614`). It's a limitation of how `lab` processes transformed output for coverage.
For consistent behavior, install `lab-transform-typescript` directly via `npm install --save-dev` rather than `npm link` in production or shared development environments, ensuring `typescript` is a direct `devDependency` of your project.
`npm install typescript --save-dev` to add `typescript` to your project's development dependencies.
Ensure `lab --transform node_modules/lab-transform-typescript` is correctly specified in your test command and that the path to the transform is accurate. Also, ensure `lab` itself is configured to process the correct file extensions (e.g., `.ts`).
Double-check the path provided to `TSCONFIG`. Ensure the `tsconfig.json` file exists at the specified path or in a location where TypeScript's default search mechanism would find it (e.g., project root). Ensure you are on `lab-transform-typescript` v3 or newer for this feature.