Karma ClojureScript Test Adapter

0.1.0 · abandoned · verified Sun Apr 19

karma-cljs-test is an adapter for the Karma test runner, enabling it to execute tests written with the ClojureScript `cljs.test` testing framework. First published 11 years ago, its latest and only version is 0.1.0, indicating it is no longer actively maintained. The package integrates into Karma's configuration by specifying 'cljs-test' as a framework. Its utility is highly specialized for projects using ClojureScript with Karma, a combination that has largely been superseded by other testing approaches within the ClojureScript ecosystem, such as `doo` or direct integration with modern test runners via `shadow-cljs` output. The core dependency, Karma, has also been deprecated, further limiting this adapter's relevance and support. There is no ongoing release cadence.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic Karma configuration (`karma.conf.js`) for running ClojureScript tests using `karma-cljs-test`. It includes paths typical for ClojureScript compilation output and shows how to set the 'cljs-test' framework and client arguments for a ClojureScript test runner function.

/* karma.conf.js */
module.exports = function(config) {
  var root = 'target/public/dev'; // Adjust this path to your ClojureScript compiled output

  config.set({
    // Base path that will be used to resolve all relative paths for files and exclude.
    basePath: '',

    // Frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['cljs-test'],

    // List of files / patterns to load in the browser
    // These files are loaded in order. Ensure your ClojureScript runtime and application code are loaded before tests.
    files: [
      root + '/goog/base.js',
      root + '/cljs_deps.js',
      root + '/app.js', // Your main application/test runner entry point
      {pattern: root + '/*.js', included: false},
      {pattern: root + '/**/*.js', included: false}
    ],

    // List of files to exclude
    exclude: [],

    // Client configuration for ClojureScript tests
    client: {
      args: ['app.test_runner.run_with_karma'] // Replace with your actual ClojureScript test runner function
    },

    // Test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // Web server port
    port: 9876,

    // Enable / disable colors in the output (reporters and logs)
    colors: true,

    // Level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // Enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // Start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneously
    concurrency: Infinity
  });
};

// To install:
// npm install --save-dev karma@~0.12.0 karma-cljs-test@~0.1.0 karma-chrome-launcher

view raw JSON →