Registry / testing / karma-jquery

karma-jquery

JSON →
library0.2.4jsnpmunverified

karma-jquery is a plugin that provides an adapter for integrating the jQuery framework into the Karma test runner environment. It allows tests executed by Karma to have jQuery available globally, facilitating the testing of jQuery-dependent code. The package is extremely old, with its latest version 0.2.4 published 9 years ago, indicating it is no longer actively maintained. This status is further compounded by the official deprecation of the Karma test runner itself as of July 2024, with no new features or general bug fixes planned. While Karma still receives critical security fixes for a limited time, `karma-jquery` is effectively abandoned. Users should consider modern alternatives for JavaScript testing, such as Jest or Web Test Runner, especially since Angular is providing migration paths off Karma.

npm install karma-jquery
INSTALL
IMPORT
SIG · KARMA-JQUERY
K
karma-jquery
testingjavascriptv0.2.4
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-jquery plugin registration
plugins: ['karma-jquery', ...]
import 'karma-jquery'
Karma plugins are not directly imported into application code. They are loaded via the `plugins` array in `karma.conf.js` and activated via the `frameworks` array. This registers the plugin with Karma's dependency injection system.
jQuery framework activation
frameworks: ['jquery', ...]
frameworks: ['karma-jquery']
After including 'karma-jquery' in the `plugins` array, the 'jquery' framework name must be added to the `frameworks` array in `karma.conf.js` to activate jQuery in the test environment. The name exposed by `karma-jquery` is 'jquery', not 'karma-jquery'.

This `karma.conf.js` configuration demonstrates how to install `karma-jquery` and include the 'jquery' framework in a Karma test run, typically alongside a testing framework like Jasmine. This ensures jQuery is available for your tests.

/* karma.conf.js */ module.exports = function(config) { config.set({ // Base path that will be used to resolve all relative paths basePath: '', // Frameworks to use // Available frameworks: https://npmjs.org/browse/keyword/karma-framework // 'jquery' MUST be listed AFTER 'jasmine' or 'mocha' if those are used, // as the plugin registers the 'jquery' framework. frameworks: ['jasmine', 'jquery'], // List of files / patterns to load in the browser files: [ // Assuming your tests rely on jQuery 'path/to/your/jquery-dependent-code.js', 'path/to/your/tests.js' ], // List of files / patterns to exclude exclude: [], // Preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: {}, // 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 }); };
Debug
Known issues
breakingThe Karma test runner itself has been officially deprecated since July 2024. It is no longer accepting new features or general bug fixes. While critical security issues are still triaged, users are strongly encouraged to migrate to alternative testing solutions.
fix
Consider migrating to modern web testing tools like Web Test Runner, Jest, or Vitest. For Angular users, migration paths are being provided.
affects: >=0.2.4
deprecatedThe `karma-jquery` package is unmaintained, with its last release (v0.2.4) over 9 years ago. It may have compatibility issues with newer Node.js versions, browser versions, or even recent versions of Karma before its deprecation.
fix
If migrating off Karma is not immediately feasible, carefully pin specific, older versions of Node.js and Karma that are known to be compatible. However, long-term migration is recommended.
affects: >=0.2.4
gotchaLoading order of frameworks in `karma.conf.js` is crucial. If `jquery` is used with another framework (like `jasmine`), `jquery` should typically be listed after the main testing framework in the `frameworks` array to ensure proper initialization.
fix
Always place `'jquery'` *after* your main testing framework (e.g., `'jasmine'`, `'mocha'`) in the `frameworks` array within `karma.conf.js`.
affects: >=0.2.0
Errors
Common errors & fixes
ReferenceError: $ is not defined
jQuery is not properly loaded or activated in your Karma tests.
fix
Ensure `karma-jquery` is installed (`npm install --save-dev karma-jquery`), added to the `plugins` array, and `'jquery'` is included in the `frameworks` array in your `karma.conf.js` file (e.g., `frameworks: ['jasmine', 'jquery']`). Also, confirm the order of frameworks is correct.
Error: No provider for "framework:jquery"! (Resolving: framework:jquery)
The `karma-jquery` plugin has not been registered correctly with Karma.
fix
Verify that `karma-jquery` is listed in the `plugins` array in `karma.conf.js` (e.g., `plugins: ['karma-jquery', 'karma-*']`). If `karma-*` autodiscovery is not used, `karma-jquery` must be explicitly listed.
Upgrade
Version history
0.2.4latest on npm
Audit
Dependencies
karmarequiredPeer dependency, as this is a Karma plugin and requires Karma to function.
Agent activity
2 hits · last 30 days
node
2
Resources
karma-jquery — npm install karma-jquery · libregistry