CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-jasmine-node

DOM-less simple JavaScript BDD testing framework for Node.js

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

cli-usage.mddocs/

CLI Usage

Comprehensive command-line interface for running jasmine-node tests with extensive configuration options for test execution, file watching, output formatting, and CI integration.

Capabilities

Basic Test Execution

Run tests from the command line with basic options.

# Basic usage
jasmine-node [options] [spec_directories...] [spec_files...]

# Examples
jasmine-node spec/
jasmine-node spec/ test/unit/
jasmine-node spec/userSpec.js spec/authSpec.js

Usage Examples:

# Display version information
jasmine-node --version

# Run all specs in spec directory
jasmine-node spec/

# Run specific spec files
jasmine-node spec/userSpec.js spec/authSpec.js

# Run specs in multiple directories
jasmine-node spec/ test/unit/ test/integration/

File Watching and Auto-Testing

Automatically re-run tests when files change during development.

# Auto-testing options
--autotest              # Automatic execution of specs after each change
--watch [paths...]      # Additional paths to watch for changes (used with --autotest)

Usage Examples:

# Auto-run tests when spec files change
jasmine-node --autotest spec/

# Watch additional directories for changes
jasmine-node --autotest --watch lib/ --watch src/ spec/

# Watch specific files
jasmine-node --autotest --watch config.js --watch package.json spec/

Output Formatting

Control test output appearance and verbosity.

# Output formatting options
--color                 # Use colored output (green for pass, red for fail)
--noColor              # Disable colored output
--verbose              # Verbose output showing individual test progress
--noStack              # Suppress stack traces on test failures

Usage Examples:

# Colorized output
jasmine-node --color spec/

# Verbose output with detailed progress
jasmine-node --verbose spec/

# Clean output without stack traces
jasmine-node --noColor --noStack spec/

# Force color output even when piping
jasmine-node --color spec/ | tee test-results.log

Test File Filtering

Filter which test files are executed based on patterns and matching rules.

# File filtering options
-m, --match REGEXP      # Only run specs containing "REGEXPspec" in filename
--matchall             # Relax requirement of "spec" in spec file names

Usage Examples:

# Only run user-related tests
jasmine-node --match user spec/

# Run tests matching specific pattern
jasmine-node --match "integration|e2e" spec/

# Allow files without "spec" in name (must still end with .js/.coffee/.litcoffee)
jasmine-node --matchall test/

Language Support

Support for CoffeeScript and Literate CoffeeScript test files.

# Language support options
--coffee               # Enable CoffeeScript support (.coffee and .litcoffee files)

Usage Examples:

# Run CoffeeScript specs
jasmine-node --coffee spec/

# Mixed JavaScript and CoffeeScript
jasmine-node --coffee spec/ # Will run .js, .coffee, and .litcoffee files

Reporting and Output

Generate reports in various formats for different environments and CI systems.

# Reporting options
--junitreport          # Export test results as JUnit XML format
--output FOLDER        # Output folder for JUnit XML reports (default: ./reports/)
--teamcity            # Convert output to TeamCity test runner format
--growl               # Display test summary in Growl notifications

Usage Examples:

# Generate JUnit XML reports
jasmine-node --junitreport spec/

# Custom output directory for reports
jasmine-node --junitreport --output ./test-reports/ spec/

# TeamCity integration
jasmine-node --teamcity spec/

# Desktop notifications (requires Growl)
jasmine-node --growl spec/

# Combined reporting
jasmine-node --junitreport --growl --output ./reports/ spec/

RequireJS Support

Integration with RequireJS for AMD module loading.

# RequireJS options
--runWithRequireJs     # Load all specs using RequireJS instead of Node's require
--requireJsSetup FILE  # Configuration file for RequireJS setup

Usage Examples:

# Use RequireJS for spec loading
jasmine-node --runWithRequireJs spec/

# Custom RequireJS configuration
jasmine-node --runWithRequireJs --requireJsSetup ./config/requirejs-test-config.js spec/

Test Environment Configuration

Configure test execution environment and behavior.

# Environment options
--test-dir PATH        # Absolute root directory path where tests are located
--nohelpers           # Skip loading helper files
--forceexit           # Force exit once tests complete
--captureExceptions   # Capture and report global exceptions
--config NAME VALUE   # Set environment variable for tests

Usage Examples:

# Set custom test directory
jasmine-node --test-dir /absolute/path/to/tests spec/

# Skip helper files
jasmine-node --nohelpers spec/

# Force exit (useful in CI environments)
jasmine-node --forceexit spec/

# Capture uncaught exceptions
jasmine-node --captureExceptions spec/

# Set environment variables
jasmine-node --config NODE_ENV test --config API_URL http://localhost:3000 spec/

# Multiple environment variables
jasmine-node --config DB_HOST localhost --config DB_PORT 5432 --config LOG_LEVEL debug spec/

Complete CLI Options Reference

# All available command-line options
jasmine-node [options] [paths...]

Options:
  --version              Display version information
  --autotest              Automatic execution after file changes
  --watch [paths...]      Watch additional paths for changes (with --autotest)
  --coffee               Execute .coffee and .litcoffee specs
  --color                Use colored output
  --noColor              Disable colored output
  -m, --match REGEXP     Match only specs containing "REGEXPspec"
  --matchall             Relax "spec" requirement in filenames
  --verbose              Verbose output during execution
  --junitreport          Export JUnit XML reports
  --output FOLDER        Output folder for JUnit reports
  --teamcity             TeamCity reporter format
  --growl                Growl notification summaries
  --runWithRequireJs     Use RequireJS for spec loading
  --requireJsSetup FILE  RequireJS configuration file
  --test-dir PATH        Absolute root test directory
  --nohelpers            Skip loading helper files
  --forceexit            Force exit after completion
  --captureExceptions    Capture global exceptions
  --config NAME VALUE    Set environment variables
  --noStack              Suppress stack traces on failures

Configuration Examples

Development Workflow

# Development with auto-testing and notifications
jasmine-node --autotest --watch lib/ --watch src/ --color --growl spec/

Continuous Integration

# CI environment with XML reports and exception handling
jasmine-node --junitreport --output ./test-reports/ --captureExceptions --forceexit --noColor spec/

TeamCity Integration

# TeamCity-specific reporting
jasmine-node --teamcity --captureExceptions --forceexit spec/

Complex Project Setup

# Large project with multiple languages and custom configuration
jasmine-node \
  --coffee \
  --runWithRequireJs \
  --requireJsSetup ./test/requirejs-config.js \
  --match "unit|integration" \
  --verbose \
  --junitreport \
  --output ./reports/ \
  --config NODE_ENV test \
  --config API_BASE_URL http://localhost:3000 \
  spec/unit/ spec/integration/

File Pattern Requirements

jasmine-node automatically discovers test files based on naming patterns:

  • JavaScript files: Must match /spec\.(js)$/i pattern (e.g., userSpec.js, authenticationSpec.js)
  • CoffeeScript files: Must match /spec\.(coffee|litcoffee)$/i pattern (e.g., userSpec.coffee, docsSpec.litcoffee)
  • Helper files: Any .js files in helper directories (loaded before specs)

Invalid examples: sampleSpecs.js, testUser.js, user-test.js Valid examples: sampleSpec.js, userSpec.js, authSpec.coffee

docs

advanced-features.md

cli-usage.md

index.md

reporters.md

test-writing.md

tile.json