tor-browser

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

chunkifyTests.js (869B)


      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 function skipTests(tests, startTestPattern, endTestPattern) {
      6  var startIndex = 0,
      7    endIndex = tests.length - 1;
      8  for (var i = 0; i < tests.length; ++i) {
      9    var test_path;
     10    if (tests[i] instanceof Object && "test" in tests[i]) {
     11      test_path = tests[i].test.url;
     12    } else if (tests[i] instanceof Object && "url" in tests[i]) {
     13      test_path = tests[i].url;
     14    } else {
     15      test_path = tests[i];
     16    }
     17    if (startTestPattern && test_path.endsWith(startTestPattern)) {
     18      startIndex = i;
     19    }
     20 
     21    if (endTestPattern && test_path.endsWith(endTestPattern)) {
     22      endIndex = i;
     23    }
     24  }
     25 
     26  return tests.slice(startIndex, endIndex + 1);
     27 }