tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

shared-jest.config.js (2408B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const fixturesDir = `${__dirname}/jest-fixtures`;
      8 
      9 module.exports = {
     10  verbose: true,
     11  moduleNameMapper: {
     12    // Custom name mappers for modules that require m-c specific API.
     13    "^devtools/shared/generate-uuid": `${fixturesDir}/generate-uuid`,
     14    "^devtools/shared/DevToolsUtils": `${fixturesDir}/devtools-utils`,
     15    // This is needed for the Debugger, for some reason
     16    "shared/DevToolsUtils": `${fixturesDir}/devtools-utils`,
     17 
     18    // Mocks only used by node tests.
     19    "Services-mock": `${fixturesDir}/Services`,
     20    "ChromeUtils-mock": `${fixturesDir}/ChromeUtils`,
     21 
     22    "^Glean": `${fixturesDir}/Glean`,
     23    "^promise": `${fixturesDir}/promise`,
     24    "^resource://devtools/client/shared/fluent-l10n/fluent-l10n.js": `${fixturesDir}/fluent-l10n`,
     25    "^resource://devtools/client/shared/unicode-url.js": `${fixturesDir}/unicode-url`,
     26    // This is needed for the Debugger, for some reason
     27    "shared/unicode-url.js": `${fixturesDir}/unicode-url`,
     28    "shared/telemetry.js": `${fixturesDir}/telemetry`,
     29    "^resource://devtools/client/shared/telemetry.js": `${fixturesDir}/telemetry`,
     30    // This is needed for the Debugger, for some reason
     31    "client/shared/telemetry$": `${fixturesDir}/telemetry`,
     32    "devtools/shared/plural-form$": `${fixturesDir}/plural-form`,
     33    // Sometimes returning an empty object is enough
     34    "^resource://devtools/client/shared/link": `${fixturesDir}/empty-module`,
     35    "resource://devtools/shared/validate-breakpoint.sys.mjs": `${fixturesDir}/empty-module`,
     36    "resource://services-settings/remote-settings.sys.mjs": `${fixturesDir}/empty-module`,
     37    "^devtools/shared/flags": `${fixturesDir}/empty-module`,
     38    "^resource://devtools/shared/indexed-db.js": `${fixturesDir}/indexed-db`,
     39    "^devtools/shared/layout/utils": `${fixturesDir}/empty-module`,
     40    "^devtools/client/shared/components/tree/TreeView.mjs": `${fixturesDir}/empty-module`,
     41    "/target-command.js": `${fixturesDir}/target-command`,
     42    // Map all require("devtools/...") to the real devtools root.
     43    "^devtools/(.*)": `${__dirname}/../../../$1`,
     44    "^resource://devtools/(.*)": `${__dirname}/../../../$1`,
     45  },
     46  transform: {
     47    "\\.m?js$": "babel-jest",
     48  },
     49 };