chunkifyTests.js 882 B

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