Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

1.3 KB
Raw Blame
// Shared configuration for Mocha browser tests, used by the Playwright config, the static server, and the Playwright test suite.
// Each suite runs in its own page because Mocha's interfaces ("bdd", "tdd", "qunit") can only be registered once per browser context. That means we can't reuse a single Mocha instance across multiple suites.

export const PORT = Number(process.env.MOCHA_BROWSER_TEST_PORT) || 8787;

export const baseURL = `http://localhost:${PORT}`;

// This file is generated by global-setup.js
export const SETUP_BUNDLE_PATH = "test/browser/.generated/setup.cjs";

/**
 * @typedef {object} BrowserSuite
 * @property {string} name Unique suite identifier (also used for the /run/<name> route).
 * @property {string} ui Mocha interface to register before loading specs.
 * @property {string[]} [specs] Classic script files (no import/require).
 * @property {string[]} [modules] ES module scripts loaded via "type=module".
 */

/** @type {BrowserSuite[]} */
export const suites = [
  { name: "bdd", ui: "bdd", specs: ["/test/interfaces/bdd.spec.js"] },
  { name: "tdd", ui: "tdd", specs: ["/test/interfaces/tdd.spec.js"] },
  { name: "qunit", ui: "qunit", specs: ["/test/interfaces/qunit.spec.js"] },
  { name: "esm", ui: "bdd", modules: ["/test/browser-specific/esm.spec.js"] },
];