{"id":13363,"library":"jasmine-ts","title":"Jasmine TypeScript Runner","description":"jasmine-ts is a command-line utility designed to simplify the process of running Jasmine tests written in TypeScript. It achieves this by leveraging `ts-node` to transpile TypeScript specifications on the fly, eliminating the need for a separate compilation step. The package is currently at version 0.4.0. Its release cadence is infrequent, suggesting an active but early-stage development. A key differentiator is its direct execution model through a single CLI command, seamlessly integrating with `package.json` scripts. It also provides robust support for configuring Jasmine reporters directly within the `jasmine.json` file, even allowing specific named exports from reporter modules using a `#` separator. Furthermore, it transparently passes through `ts-node` configuration options, offering flexibility in how TypeScript is handled during test execution. It acts as a wrapper around Jasmine and `ts-node`, streamlining the setup for TypeScript-based unit testing.","status":"active","version":"0.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/svi3c/jasmine-ts","tags":["javascript","node","testing","tests","jasmine","typescript"],"install":[{"cmd":"npm install jasmine-ts","lang":"bash","label":"npm"},{"cmd":"yarn add jasmine-ts","lang":"bash","label":"yarn"},{"cmd":"pnpm add jasmine-ts","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core testing framework required for defining and running tests.","package":"jasmine","optional":false},{"reason":"Required for on-the-fly TypeScript compilation and execution in Node.js.","package":"ts-node","optional":false},{"reason":"The TypeScript compiler is necessary for type checking and transpilation.","package":"typescript","optional":false},{"reason":"Provides TypeScript type definitions for Jasmine to ensure correct type checking in test files.","package":"@types/jasmine","optional":false}],"imports":[{"note":"The primary usage is via `package.json` scripts, where `jasmine-ts` is invoked with a glob pattern for your TypeScript test files. Running `jasmine-ts` without arguments will likely result in an error as it expects a glob.","wrong":"jasmine-ts","symbol":"CLI Command","correct":"\"test\": \"jasmine-ts \\\"path/to/specs/**/*.spec.ts\\\"\""},{"note":"Run this command once to generate a `jasmine.json` configuration file, which can then be customized for reporters and other settings. Ensure `node_modules/.bin` is in your PATH or use the full path.","wrong":"jasmine-ts init","symbol":"Initialization Command","correct":"node_modules/.bin/jasmine-ts init"},{"note":"When configuring custom reporters in `jasmine.json`, use the `#` separator to reference named exports from reporter modules, as shown with `jasmine-spec-reporter#SpecReporter`.","wrong":"{\n  \"reporters\": [\n    {\n      \"name\": \"jasmine-spec-reporter\",\n      \"options\": {}\n    }\n  ]\n}","symbol":"Reporter Configuration","correct":"{\n  \"reporters\": [\n    {\n      \"name\": \"jasmine-spec-reporter#SpecReporter\",\n      \"options\": {\n        \"displayStacktrace\": \"all\"\n      }\n    }\n  ]\n}"}],"quickstart":{"code":"// 1. Initialize your project:\n//    npm init -y\n// 2. Install dependencies:\n//    npm i -D jasmine jasmine-ts ts-node@^10 typescript @types/jasmine\n\n// package.json (excerpt for scripts and devDependencies)\n// {\n//   \"scripts\": {\n//     \"test\": \"jasmine-ts \\\"./src/**/*.spec.ts\\\"\"\n//   },\n//   \"devDependencies\": {\n//     \"jasmine\": \"^5.0.0\",\n//     \"jasmine-ts\": \"0.4.0\",\n//     \"ts-node\": \"^10.0.0\", // Ensure ts-node version is <=11 for jasmine-ts 0.4.0 compatibility\n//     \"typescript\": \"^5.0.0\",\n//     \"@types/jasmine\": \"^5.0.0\"\n//   }\n// }\n\n// 3. Generate jasmine.json configuration file:\n//    node_modules/.bin/jasmine-ts init\n\n// 4. Create a TypeScript test file (e.g., src/my.spec.ts):\ndescribe('My test suite', () => {\n  let counter = 0;\n\n  beforeEach(() => {\n    counter++;\n  });\n\n  it('should increment the counter', () => {\n    expect(counter).toBe(1);\n  });\n\n  it('should have an updated counter for the next spec', () => {\n    expect(counter).toBe(2);\n  });\n\n  it('should allow async operations', async () => {\n    await new Promise(resolve => setTimeout(resolve, 10));\n    expect(true).toBe(true);\n  });\n});\n\n// 5. Run your tests:\n//    npm test","lang":"typescript","description":"This quickstart demonstrates how to set up `jasmine-ts` to run TypeScript-based Jasmine tests, including installation, `jasmine.json` initialization, and a minimal runnable test suite."},"warnings":[{"fix":"Ensure your `ts-node` installation is within the compatible range (e.g., `npm i -D ts-node@^10`).","message":"The package specifies a peer dependency for `ts-node` with a version range `>=3.2.0 <=11`. Using `ts-node` versions higher than 11 (e.g., v12+) may lead to compatibility issues or errors, as `ts-node` has undergone significant changes in newer versions, particularly regarding ESM support.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Install the type definitions: `npm i -D @types/jasmine`.","message":"For TypeScript projects, it is crucial to install `@types/jasmine` to provide type definitions for Jasmine's global functions (`describe`, `it`, `expect`, etc.). Without these typings, the TypeScript compiler will report errors about undeclared globals.","severity":"gotcha","affected_versions":">=0.0.3"},{"fix":"Avoid `typings i -DG dt~jasmine`; instead, use `npm i -D @types/jasmine`.","message":"Older versions of TypeScript (prior to 2.0) often relied on the `typings` tool for managing type definitions. For TypeScript 2.0 and later, the official method is to use `@types/` packages from npm.","severity":"deprecated","affected_versions":">=0.0.3"},{"fix":"Consult `ts-node` documentation for relevant configuration options and ensure your `tsconfig.json` is correctly set up for your project and test environment.","message":"`jasmine-ts` passes `ts-node` options through directly since version `0.1.3`. Users need to be aware of `ts-node`'s configuration options (e.g., `compilerOptions`, `files`, `transpileOnly`) to properly configure how TypeScript files are handled during testing. Incorrect `tsconfig.json` or `ts-node` options can lead to compilation or runtime errors.","severity":"gotcha","affected_versions":">=0.1.3"},{"fix":"Consider checking for alternative tools or forks if you require features not present in the current version or need active maintenance.","message":"The `jasmine-ts` project itself appears to be archived on GitHub as of December 3, 2022, and marked as read-only. While the package is still available on npm, active development and official support for new features or bug fixes might be limited.","severity":"gotcha","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Install Jasmine: `npm i -D jasmine`","cause":"The `jasmine` package, a peer dependency, is not installed in the project.","error":"Error: Cannot find module 'jasmine'"},{"fix":"Downgrade `ts-node` to a compatible version, for example: `npm i -D ts-node@^10`.","cause":"This error or similar runtime issues can occur if an incompatible version of `ts-node` is installed, especially if it's newer than the `ts-node@11` range specified by `jasmine-ts`.","error":"TypeError: Cannot read properties of undefined (reading 'register')"},{"fix":"Install `@types/jasmine`: `npm i -D @types/jasmine`","cause":"The TypeScript compiler cannot find the global type definitions for Jasmine's testing constructs.","error":"Type 'typeof describe' is not assignable to type '...'. Property 'name' is missing in type 'typeof describe'."},{"fix":"Install `@types/jasmine`: `npm i -D @types/jasmine`","cause":"Similar to the above, this indicates missing global type definitions for Jasmine in your TypeScript environment.","error":"Cannot find name 'describe'."},{"fix":"Ensure the reporter package is installed (`npm i -D my-custom-reporter`) and verify the exact `name` string, including the `#` separator if applicable, in your `jasmine.json`.","cause":"The custom reporter module is not installed, or the name/path in `jasmine.json` is incorrect, or the specific export (`#MyReporter`) does not exist.","error":"Unknown reporter: my-custom-reporter#MyReporter"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"jasmine-ts","cli_version":null}