CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-karma-qunit

A Karma plugin that provides an adapter for the QUnit testing framework, enabling seamless integration between Karma test runner and QUnit test suites.

92

0.97x
Quality

Pending

Does it follow best practices?

Impact

92%

0.97x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-5/

QUnit Test Suite Integration

Build a test runner configuration that integrates QUnit tests with the test execution framework to run tests across multiple browsers.

Requirements

Your task is to configure a test runner that executes QUnit tests and reports the results properly. The configuration should:

  1. Set up the test execution framework to run QUnit tests
  2. Configure the framework to load and execute tests from a test file
  3. Ensure proper test result reporting and lifecycle management
  4. Run tests in at least one browser (Chrome in headless mode)

Test File

Create a test file tests/calculator.test.js that tests a simple calculator module:

  • Test addition: verify that 2 + 3 = 5 @test
  • Test subtraction: verify that 5 - 2 = 3 @test
  • Test multiplication: verify that 4 * 3 = 12 @test

Implementation Files

Create the following files:

  1. karma.conf.js - Configuration file for the test runner @generates
  2. tests/calculator.test.js - QUnit test file for calculator functions @generates
  3. src/calculator.js - Simple calculator module with add, subtract, and multiply functions @generates

Expected Behavior

When you run the test suite:

  • All three tests should execute successfully
  • Test results should be reported to the console
  • The test runner should exit with code 0 if all tests pass
  • Tests should run in a headless browser environment

Dependencies { .dependencies }

karma-qunit { .dependency }

Provides QUnit test framework integration with the test runner.

qunit { .dependency }

QUnit testing framework for writing and running tests.

karma { .dependency }

Test runner that executes tests across multiple browsers.

karma-chrome-launcher { .dependency }

Launcher for running tests in Chrome browser.

tile.json