Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 46x 46x 46x 33x 4x 4x 4x 33x 31x 31x 31x 31x 25x 25x 25x 25x 25x 6x 6x 6x 6x 6x 6x 19x 25x 3x 3x 16x 16x 31x 31x 31x 31x 33x 33x 33x 33x 33x 33x | 'use strict'; const { RegExpPrototypeExec } = primordials; const { basename } = require('path'); const { createDeferredPromise } = require('internal/util'); const { codes: { ERR_TEST_FAILURE, }, } = require('internal/errors'); const kMultipleCallbackInvocations = 'multipleCallbackInvocations'; const kSupportedFileExtensions = /\.[cm]?js$/; const kTestFilePattern = /((^test(-.+)?)|(.+[.\-_]test))\.[cm]?js$/; function doesPathMatchFilter(p) { return RegExpPrototypeExec(kTestFilePattern, basename(p)) !== null; } function isSupportedFileType(p) { return RegExpPrototypeExec(kSupportedFileExtensions, p) !== null; } function createDeferredCallback() { let calledCount = 0; const { promise, resolve, reject } = createDeferredPromise(); const cb = (err) => { calledCount++; // If the callback is called a second time, let the user know, but // don't let them know more than once. if (calledCount > 1) { if (calledCount === 2) { throw new ERR_TEST_FAILURE( 'callback invoked multiple times', kMultipleCallbackInvocations ); } return; } if (err) { return reject(err); } resolve(); }; return { promise, cb }; } module.exports = { createDeferredCallback, doesPathMatchFilter, isSupportedFileType, }; |