mirror of
https://github.com/nodejs/node.git
synced 2025-04-30 07:19:19 +00:00

This commit introduces an initial version of a CLI-based test runner. PR-URL: https://github.com/nodejs/node/pull/42658 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
16 lines
489 B
JavaScript
16 lines
489 B
JavaScript
'use strict';
|
|
const { RegExpPrototypeExec } = primordials;
|
|
const { basename } = require('path');
|
|
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;
|
|
}
|
|
|
|
module.exports = { isSupportedFileType, doesPathMatchFilter };
|