tor-browser

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

tests-setup.js (1304B)


      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 import path from "path";
      6 import { prefs } from "../utils/prefs";
      7 
      8 import { PrettyPrintDispatcher } from "../workers/pretty-print/index";
      9 import { ParserDispatcher } from "../workers/parser";
     10 import { SearchDispatcher } from "../workers/search/index";
     11 
     12 const rootPath = path.join(__dirname, "../../");
     13 
     14 jest.setTimeout(20000);
     15 
     16 function formatException(reason, p) {
     17  console && console.log("Unhandled Rejection at:", p, "reason:", reason);
     18 }
     19 
     20 export const parserWorker = new ParserDispatcher(
     21  path.join(rootPath, "src/workers/parser/worker.js")
     22 );
     23 export const prettyPrintWorker = new PrettyPrintDispatcher(
     24  path.join(rootPath, "src/workers/pretty-print/worker.js")
     25 );
     26 export const searchWorker = new SearchDispatcher(
     27  path.join(rootPath, "src/workers/search/worker.js")
     28 );
     29 
     30 beforeAll(() => {
     31  process.on("unhandledRejection", formatException);
     32 });
     33 
     34 afterAll(() => {
     35  parserWorker.stop();
     36  prettyPrintWorker.stop();
     37  searchWorker.stop();
     38 
     39  process.removeListener("unhandledRejection", formatException);
     40 });
     41 
     42 afterEach(() => {});
     43 
     44 beforeEach(async () => {
     45  prefs.expressions = [];
     46 });