QUnit.config.storage

version added: 2.1.0.

Description

The Storage object to use for remembering failed tests between runs.

type object or undefined
default globalThis.sessionStorage or undefined

This is used to power the reorder feature. In browser environments this will use sessionStorage if supported by the browser.

In Node.js and other non-browser environments, there is no storage object available for this purpose by default. You can attach your own preferred form of persistence between test runs, by assigning an object to QUnit.config.storage that implements at least the below subset of the Web Storage API.

Storage interface

storage = {
  /**
   * @param {string} key
   * @param {string} value
   */
  setItem (key, value) {
  },

  /**
   * @param {string} key
   * @return {string|null}
   */
  getItem (key) {
  },

  /**
   * @param {string} key
   */
  removeItem (key) {
  },

  /**
   * Get name of key at given offset, e.g. by iterating from 0 to `length`.
   *
   * @param {number} index
   * @return {string|null}
   */
  key (index) {
  },

  /**
   * How many keys exist.
   *
   * @type {number}
   */
  get length () {
  }
};