WIP: Include test files in imports/ directories

This commit is contained in:
Avital Oliver
2016-02-16 12:15:56 -08:00
parent 3ffccb9512
commit 9ec968ec65
2 changed files with 24 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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) ||