mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
WIP: Include test files in imports/ directories
This commit is contained in:
@@ -384,10 +384,30 @@ class ResourceSlot {
|
||||
// contained by a node_modules directory will already have been
|
||||
// marked lazy in PackageSource#_inferFileOptions. Same for
|
||||
// non-test files if running unit tests (`meteor test-app --unit`)
|
||||
return this.packageSourceBatch.useMeteorInstall &&
|
||||
if (!this.packageSourceBatch.useMeteorInstall) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const dirs =
|
||||
files.pathDirname(this.inputResource.path)
|
||||
.split(files.pathSep)
|
||||
.indexOf("imports") >= 0;
|
||||
.split(files.pathSep);
|
||||
|
||||
const isInImports = dirs.indexOf("imports") >= 0;
|
||||
|
||||
if (global.testCommandMetadata &&
|
||||
(global.testCommandMetadata.isUnitTest ||
|
||||
global.testCommandMetadata.isIntegrationTest)) {
|
||||
const isTestFile = _.any(dirs, (dir) =>
|
||||
/\.tests?\./.test(dir) ||
|
||||
/^tests?\./.test(dir) ||
|
||||
/^tests$/.test(dir));
|
||||
|
||||
// test files should always be included, if we're running app
|
||||
// tests.
|
||||
return isInImports && !isTestFile;
|
||||
} else {
|
||||
return isInImports;
|
||||
}
|
||||
}
|
||||
|
||||
addStylesheet(options) {
|
||||
|
||||
@@ -1344,7 +1344,7 @@ _.extend(PackageSource.prototype, {
|
||||
|
||||
// If running in unit test mode (`meteor test-app --unit`), all
|
||||
// files other than test files should be loaded lazily
|
||||
if (global.testCommandMetadata && testCommandMetadata.isUnitTest) {
|
||||
if (global.testCommandMetadata && global.testCommandMetadata.isUnitTest) {
|
||||
const isTestFile = _.any(dirs, (dir) =>
|
||||
/\.tests?\./.test(dir) ||
|
||||
/^tests?\./.test(dir) ||
|
||||
|
||||
Reference in New Issue
Block a user