{"id":11200,"library":"karma-jquery","title":"Karma jQuery Adapter","description":"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.","status":"abandoned","version":"0.2.4","language":"javascript","source_language":"en","source_url":"git://github.com/scf2k/karma-jquery","tags":["javascript","karma-plugin","karma-framework","jquery"],"install":[{"cmd":"npm install karma-jquery","lang":"bash","label":"npm"},{"cmd":"yarn add karma-jquery","lang":"bash","label":"yarn"},{"cmd":"pnpm add karma-jquery","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency, as this is a Karma plugin and requires Karma to function.","package":"karma","optional":false}],"imports":[{"note":"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.","wrong":"import 'karma-jquery'","symbol":"karma-jquery plugin registration","correct":"plugins: ['karma-jquery', ...]"},{"note":"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'.","wrong":"frameworks: ['karma-jquery']","symbol":"jQuery framework activation","correct":"frameworks: ['jquery', ...]"}],"quickstart":{"code":"/* karma.conf.js */\nmodule.exports = function(config) {\n  config.set({\n    // Base path that will be used to resolve all relative paths\n    basePath: '',\n\n    // Frameworks to use\n    // Available frameworks: https://npmjs.org/browse/keyword/karma-framework\n    // 'jquery' MUST be listed AFTER 'jasmine' or 'mocha' if those are used, \n    // as the plugin registers the 'jquery' framework.\n    frameworks: ['jasmine', 'jquery'], \n\n    // List of files / patterns to load in the browser\n    files: [\n      // Assuming your tests rely on jQuery\n      'path/to/your/jquery-dependent-code.js',\n      'path/to/your/tests.js'\n    ],\n\n    // List of files / patterns to exclude\n    exclude: [],\n\n    // Preprocess matching files before serving them to the browser\n    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor\n    preprocessors: {},\n\n    // Test results reporter to use\n    // possible values: 'dots', 'progress'\n    // available reporters: https://npmjs.org/browse/keyword/karma-reporter\n    reporters: ['progress'],\n\n    // Web server port\n    port: 9876,\n\n    // Enable / disable colors in the output (reporters and logs)\n    colors: true,\n\n    // Level of logging.\n    // Possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG\n    logLevel: config.LOG_INFO,\n\n    // Enable / disable watching file and executing tests whenever any file changes\n    autoWatch: true,\n\n    // Start these browsers\n    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher\n    browsers: ['Chrome'],\n\n    // Continuous Integration mode\n    // If true, Karma captures browsers, runs the tests and exits\n    singleRun: false,\n\n    // Concurrency level\n    // How many browser should be started simultaneously\n    concurrency: Infinity\n  });\n};\n","lang":"javascript","description":"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."},"warnings":[{"fix":"Consider migrating to modern web testing tools like Web Test Runner, Jest, or Vitest. For Angular users, migration paths are being provided.","message":"The 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.","severity":"breaking","affected_versions":">=0.2.4"},{"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.","message":"The `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.","severity":"deprecated","affected_versions":">=0.2.4"},{"fix":"Always place `'jquery'` *after* your main testing framework (e.g., `'jasmine'`, `'mocha'`) in the `frameworks` array within `karma.conf.js`.","message":"Loading 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.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"jQuery is not properly loaded or activated in your Karma tests.","error":"ReferenceError: $ is not defined"},{"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.","cause":"The `karma-jquery` plugin has not been registered correctly with Karma.","error":"Error: No provider for \"framework:jquery\"! (Resolving: framework:jquery)"}],"ecosystem":"npm"}