mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
* Adjust test filename RegExps to match Meteor guide. Fixes #9332. * Adjusted help text for --drive-package on meteor test. * Add integration tests for `meteor test` eager file loading. * Fix typo in selftest.forbid comment. * Improve test file eager load integration test coverage and clarity.
31 lines
789 B
JavaScript
31 lines
789 B
JavaScript
import _ from 'underscore';
|
|
import { pathSep } from '../fs/files';
|
|
|
|
// We have two things "tests" and "app-tests".
|
|
export const TEST_FILENAME_REGEXPS = [
|
|
// "*.test[s].*" or "*.spec[s].*"
|
|
/\.test\./,
|
|
/\.tests\./,
|
|
/\.spec\./,
|
|
/\.specs\./,
|
|
];
|
|
|
|
export const APP_TEST_FILENAME_REGEXPS = [
|
|
// "*.app-test[s].*" or "*.app-spec[s].*"
|
|
/\.app-test\./,
|
|
/\.app-tests\./,
|
|
/\.app-spec\./,
|
|
/\.app-specs\./,
|
|
];
|
|
|
|
// Given a path to a file in an app (relative to the app root
|
|
// directory), is this file a test file?
|
|
export function isTestFilePath(path) {
|
|
const splitPath = path.split(pathSep);
|
|
|
|
// Does the filename match one of the test filename forms?
|
|
return _.any(
|
|
[...TEST_FILENAME_REGEXPS, ...APP_TEST_FILENAME_REGEXPS],
|
|
regexp => regexp.test(_.last(splitPath)));
|
|
}
|