{"id":11124,"library":"jasmine-node","title":"Jasmine-Node Test Runner","description":"Jasmine-node is a command-line utility designed for running Jasmine BDD specifications (specifically version 1.3.1, a forked version from the Karma project) within a Node.js environment without requiring a browser DOM. It provides a simple CLI for executing tests written in JavaScript or CoffeeScript, offering features like automatic test execution on file changes (`--autotest`), colorized output, and optional Growl notifications. The project is explicitly in maintenance mode, and its authors recommend using the official `jasmine` or `jasmine-npm` packages for any new development due to `jasmine-node`'s reliance on an older Jasmine version and limited future development. It supports Node.js versions 10 and 12, with older Node.js versions being deprecated.","status":"maintenance","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/mhevery/jasmine-node","tags":["javascript","testing","bdd"],"install":[{"cmd":"npm install jasmine-node","lang":"bash","label":"npm"},{"cmd":"yarn add jasmine-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add jasmine-node","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"jasmine-node is primarily a command-line interface tool. Its core functionality for running tests is invoked via the CLI after global installation, not typically through direct programmatic imports for standard testing workflows. This entry refers to its main CLI usage pattern.","wrong":"import { jasmineNode } from 'jasmine-node'","symbol":"CLI Tool Execution","correct":"Install globally: npm install jasmine-node -g\nRun tests: jasmine-node spec/"},{"note":"Jasmine-node, like the Jasmine framework it bundles, exposes its core BDD functions (like `describe`, `it`, `expect`, `beforeEach`, `afterEach`) as global variables within the test execution context. They are not intended to be imported as modules from the `jasmine-node` package itself in test files.","wrong":"import { describe, it, expect } from 'jasmine-node'","symbol":"describe, it, expect","correct":"// These functions are made globally available by the jasmine-node runner when executing tests."},{"note":"While it is technically possible to `require` internal modules like the CLI runner for advanced, non-standard programmatic invocation, this approach is strongly discouraged. The package's internal structure is not guaranteed to be stable or part of a public API for direct programmatic access.","wrong":"import * as jasmineNode from 'jasmine-node'","symbol":"Programmatic Runner Access","correct":"const cliRunner = require('jasmine-node/lib/jasmine-node/cli'); // Highly discouraged, use CLI instead"}],"quickstart":{"code":"npm install jasmine-node -g\n\n// Create a spec file (e.g., 'spec/example-spec.js')\n// NOTE: The filename MUST end with 'spec.js', 'spec.coffee', or 'spec.litcoffee'\ndescribe('A basic Jasmine suite', function() {\n  // Synchronous test\n  it('should verify true is true', function() {\n    expect(true).toBe(true);\n  });\n\n  // Asynchronous test with 'done'\n  it('should handle async operations', function(done) {\n    setTimeout(function() {\n      expect('async').toBe('async');\n      done();\n    }, 50);\n  });\n\n  // Using ddescribe to run only this suite (feature from Karma fork)\n  ddescribe('A focused suite example', function() {\n    it('should be the only test suite executed', function() {\n      expect(1).not.toBe(2);\n    });\n  });\n});\n\n// Run tests from the command line in your project's root directory\njasmine-node spec/","lang":"javascript","description":"Demonstrates the global installation of `jasmine-node`, the creation of a standard Jasmine spec file (including sync, async, and `ddescribe` examples), and how to execute these tests using the `jasmine-node` command-line interface."},"warnings":[{"fix":"Migrate your existing tests to use the official `jasmine` package or a modern alternative like `Jest`. Be aware of API changes between Jasmine 1.x and 2.x, particularly around asynchronous testing (e.g., `done()` callbacks instead of `runs`/`waitsFor`).","message":"The `jasmine-node` project is in maintenance mode and relies on an outdated Jasmine 1.3.1. It is highly recommended to migrate to the actively maintained official `jasmine` or `jasmine-npm` packages for modern testing environments and newer Jasmine versions (2.x+).","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Upgrade your Node.js runtime environment to version 10 or 12 to ensure compatibility and receive any potential bug fixes. For environments requiring newer Node.js versions, consider migrating to a more actively maintained testing framework.","message":"Support for Node.js versions 8, 6, and 4 is deprecated and has reached End-of-Life. The package only officially supports Node.js versions 10 and 12.","severity":"deprecated","affected_versions":"<10.0.0"},{"fix":"Stick to the main `jasmine-node` branch for Jasmine 1.3.1 compatibility, or migrate entirely to the `jasmine` / `jasmine-npm` packages for proper Jasmine 2.x and later support.","message":"The `Jasmine2.0` branch, which aimed to support Jasmine 2.0 with a CoffeeScript rewrite, has been explicitly abandoned and is no longer supported. Do not attempt to use it or expect Jasmine 2.x features within `jasmine-node`.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Rename your test files to follow the convention (e.g., `myFeatureSpec.js` instead of `myFeature.js`). Alternatively, you can use the `--matchall` flag when running `jasmine-node` to relax this filename requirement, though adhering to the convention is generally best practice.","message":"Spec files must adhere to a specific naming convention to be discovered by the runner: their filenames must match the regular expression `/spec\\.(js|coffee|litcoffee)$/i`. This means they typically end with `spec.js`, `spec.coffee`, or `spec.litcoffee`.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Always run your tests using the `jasmine-node` CLI command, specifying the directory where your specs are located (e.g., `jasmine-node spec/`).","cause":"This error occurs when a test file is executed directly using `node` (e.g., `node spec/my-test-spec.js`) instead of through the `jasmine-node` command-line runner. The runner is responsible for setting up Jasmine's global functions like `describe`, `it`, and `expect`.","error":"ReferenceError: describe is not defined"},{"fix":"Verify that your spec files are correctly placed in the directory you're passing to `jasmine-node` (e.g., `spec/`) and that their names conform to the `*spec.js` pattern. If you've used non-standard naming, try running with the `--matchall` flag.","cause":"This usually indicates that `jasmine-node` could not locate any test files. Common causes include spec files not being in the specified directory, or their filenames not matching the required `*spec.js` (or `.coffee`, `.litcoffee`) pattern.","error":"No specs found"}],"ecosystem":"npm"}