Registry / testing / karma-cljs-test

karma-cljs-test

JSON →
library0.1.0jsnpmunverified

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.

npm install karma-cljs-test
INSTALL
IMPORT
SIG · KARMA-CLJS-TEST
K
karma-cljs-test
testingjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

karma.conf.js frameworks array
config.set({ frameworks: ['cljs-test'], // ... });
import { CljsTest } from 'karma-cljs-test'
This package is a Karma plugin/adapter. It is not imported directly into userland JavaScript/TypeScript code. Instead, it is loaded by Karma via its configuration file (karma.conf.js) by adding 'cljs-test' to the 'frameworks' array.

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
Debug
Known issues
breakingThe `karma-cljs-test` package is 11 years old (v0.1.0) and has not received updates since July 2015. It is highly unlikely to be compatible with modern Node.js versions, recent Karma releases, or current ClojureScript compilation toolchains (e.g., `shadow-cljs`) without significant issues or manual patching.
fix
Consider migrating to alternative ClojureScript testing setups, such as `doo` (for browser testing) or directly integrating with modern JavaScript test runners (e.g., Jest, Web Test Runner) via ClojureScript's ES module or CommonJS output targets with `shadow-cljs`. If Karma is absolutely required, use older, compatible versions of Node.js and Karma (e.g., Karma 0.12.x).
affects: >=0.1.0
deprecatedThe Karma test runner itself, the fundamental dependency for `karma-cljs-test`, has been officially deprecated. While critical security fixes may be provided for a limited time, active development and new features have ceased, impacting the long-term viability and support for any Karma-based testing solution.
fix
Plan a migration away from Karma to modern browser-based unit testing solutions like Web Test Runner or `jasmine-browser-runner`, or Node.js-based alternatives such as Jest or Vitest, which offer more performant and actively maintained options.
affects: >=0.1.0
gotchaThe `files` configuration in `karma.conf.js` is highly specific to the ClojureScript compilation output and project structure of the era when this package was active. Paths like `root + '/goog/base.js'` and `root + '/cljs_deps.js'` assume a Google Closure Compiler-based build without advanced optimizations, common with `lein-cljsbuild`. Modern ClojureScript build tools like `shadow-cljs` might produce different file structures or integrate testing differently.
fix
Carefully review and adjust the `files` array to precisely match the generated JavaScript artifacts from your specific ClojureScript compiler and build configuration. Ensure the correct loading order of the Google Closure Library, your compiled application code, and test runner. For `shadow-cljs`, consider using its built-in Karma target if available, or generating ESM/CommonJS modules and using a more modern test runner.
affects: >=0.1.0
gotchaThe adapter requires Karma `~0.12.0`. Attempting to use it with significantly newer versions of Karma (e.g., 1.x, 2.x, or the current 6.x) is very likely to lead to incompatibility errors due to breaking changes in Karma's API over time.
fix
Always install the specific Karma version `~0.12.0` as indicated in the README. If you must use a newer Karma version, prepare for extensive debugging and potential re-implementation of parts of the adapter, or switch to a different ClojureScript testing solution.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'karma-cljs-test'
The package was not installed or is not correctly discoverable by Karma.
fix
Ensure `karma-cljs-test` is listed in your `package.json`'s `devDependencies` and installed via `npm install` or `yarn install`. Also, verify that Karma's `plugins` configuration (if explicitly defined) includes `karma-cljs-test`.
Error: Can not load 'cljs-test' framework!
Karma cannot find or load the `karma-cljs-test` plugin, usually because it's not installed or not correctly specified in the `frameworks` array.
fix
Check your `karma.conf.js` to ensure `frameworks: ['cljs-test']` is present. Confirm `karma-cljs-test` is installed in `node_modules`. If you have a custom `plugins` array in your Karma config, ensure it includes `'karma-cljs-test'`.
SyntaxError: Unexpected token 'export' (or similar errors related to ES modules in CJS context)
Running `karma-cljs-test` (and the older Karma versions it relies on) in a modern Node.js environment or with ClojureScript outputting ES modules can cause conflicts, as the toolchain was built for CommonJS and older JavaScript runtimes.
fix
Ensure your Node.js version is compatible with the old Karma 0.12.x series. Configure your ClojureScript compiler to output CommonJS or legacy JavaScript that is compatible with the old browser environments Karma 0.12.x supports. Modern ClojureScript with ES modules will likely require a different test runner setup.
TypeError: Cannot read properties of undefined (reading 'run_with_karma')
The ClojureScript test runner function specified in `client.args` either doesn't exist, is misspelled, or hasn't been properly compiled and loaded into the browser context by Karma.
fix
Verify that your ClojureScript project is compiling successfully and producing the JavaScript file containing `app.test_runner.run_with_karma` (or your equivalent test runner). Check the `files` array in `karma.conf.js` to ensure all necessary compiled ClojureScript files are included and loaded in the correct order.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
karmarequiredRequired as the test runner to integrate the cljs.test framework. The adapter was built against Karma ~0.12.0.
Agent activity
4 hits · last 30 days
node
4
Resources
karma-cljs-test — npm install karma-cljs-test · libregistry