tor-browser

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

test_node_execute_npm.js (751B)


      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 // This test checks that npm packages can be installed and used.
      6 
      7 "use strict";
      8 
      9 const { NodeServer } = ChromeUtils.importESModule(
     10  "resource://testing-common/NodeServer.sys.mjs"
     11 );
     12 
     13 add_task(async function test_socks5_installed() {
     14  let id = await NodeServer.fork();
     15  // This is just for testing. Once we start using more useful npm packages
     16  // we can remove left-pad.
     17  equal(
     18    await NodeServer.execute(
     19      id,
     20      `const leftPad = require('left-pad'); leftPad('foo', 5)`
     21    ),
     22    "  foo"
     23  );
     24  await NodeServer.kill(id);
     25 });