From ea394be6e87f6ff677a394a22e86aafe09ab3c85 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 13 Jun 2018 17:56:04 -0400 Subject: [PATCH 1/4] Don't ignore tests/ directory if meteor.testModule defined. According to traditional Meteor file loading rules, tests/ directories are completely ignored: https://guide.meteor.com/structure.html#special-directories However, if you specify a meteor.testModule in your package.json that refers to a file inside a tests/ directory, Meteor should permit modules to be loaded from tests/, as well as any modules that are imported by the meteor.testModule entry point. Fixes #9991. --- tools/isobuild/package-source.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tools/isobuild/package-source.js b/tools/isobuild/package-source.js index 18a39c3322..4912e71993 100644 --- a/tools/isobuild/package-source.js +++ b/tools/isobuild/package-source.js @@ -889,6 +889,7 @@ _.extend(PackageSource.prototype, { sourceArch: this, ignoreFiles, isApp: true, + testModule, }; // If this architecture has a mainModule defined in @@ -1025,8 +1026,9 @@ _.extend(PackageSource.prototype, { return fileOptions; } - // Files in `imports/` should be lazily loaded *apart* from tests - if (dir === "imports" && ! isTestFile) { + // Files in `imports/` and `tests/` directories should be lazily + // loaded *apart* from tests. + if ((dir === "imports" || dir === "tests") && ! isTestFile) { fileOptions.lazy = true; } @@ -1080,6 +1082,7 @@ _.extend(PackageSource.prototype, { watchSet, isApp, sourceArch, + testModule, loopChecker = new SymlinkLoopChecker(this.sourceRoot), ignoreFiles = [] }) { @@ -1102,10 +1105,10 @@ _.extend(PackageSource.prototype, { // Unless we're running tests, ignore all test filenames and if we are, ignore the // type of file we *aren't* running if (!global.testCommandMetadata || global.testCommandMetadata.isTest) { - Array.prototype.push.apply(sourceReadOptions.exclude, APP_TEST_FILENAME_REGEXPS); + sourceReadOptions.exclude.push(...APP_TEST_FILENAME_REGEXPS); } if (!global.testCommandMetadata || global.testCommandMetadata.isAppTest) { - Array.prototype.push.apply(sourceReadOptions.exclude, TEST_FILENAME_REGEXPS); + sourceReadOptions.exclude.push(...TEST_FILENAME_REGEXPS); } // Read top-level source files, excluding control files that were not @@ -1116,13 +1119,21 @@ _.extend(PackageSource.prototype, { controlFiles.push('package.js'); } - const anyLevelExcludes = [ - /^tests\/$/, + const anyLevelExcludes = []; + + // If we have a meteor.testModule from package.json, then we don't + // need to exclude tests/ directories from the search, because we + // trust meteor.testModule to identify a single test entry point. + if (! testModule) { + anyLevelExcludes.push(/^tests\/$/); + } + + anyLevelExcludes.push( archinfo.matches(arch, "os") ? /^client\/$/ : /^server\/$/, ...sourceReadOptions.exclude, - ]; + ); const topLevelExcludes = isApp ? [ ...anyLevelExcludes, From 3c4944479d3a7fb9f7a074bb8d681d6209914478 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 13 Jun 2018 18:03:21 -0400 Subject: [PATCH 2/4] Bump package versions for 1.7.0.3-rc.0 release. --- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 0c3f6c7a78..62c8e69fe4 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.7.0_2' + version: '1.7.0-3-rc.0' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index da3dc5e1ee..873da558e9 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "1.7.0.2-rc.0", + "version": "1.7.0.3-rc.0", "recommended": false, "official": false, "description": "Meteor" From ec5c356d0d6cc5e377a4bd9ccc91a4f14fab2083 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 13 Jun 2018 18:42:27 -0400 Subject: [PATCH 3/4] Update History.md for Meteor 1.7.0.3. --- History.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/History.md b/History.md index 59a86bcf22..09664f6c17 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,12 @@ ## v.NEXT +## v1.7.0.3, 2018-06-13 + +* Fixed [Issue #9991](https://github.com/meteor/meteor/issues/9991), + introduced in + [Meteor 1.7.0.2](https://github.com/meteor/meteor/pull/9990) + by [PR #9977](https://github.com/meteor/meteor/pull/9977). + ## v1.7.0.2, 2018-06-13 * Node has been updated to version From d3b1847c0321c367812aad21c4ea8c784b3f0134 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 13 Jun 2018 19:00:18 -0400 Subject: [PATCH 4/4] Bump package versions for the official 1.7.0.3 release. https://github.com/meteor/meteor/pull/9994 --- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-official.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 62c8e69fe4..5cce8e2483 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.7.0-3-rc.0' + version: '1.7.0_3' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-official.json b/scripts/admin/meteor-release-official.json index 35eb8d9854..2716086cd7 100644 --- a/scripts/admin/meteor-release-official.json +++ b/scripts/admin/meteor-release-official.json @@ -1,11 +1,12 @@ { "track": "METEOR", - "version": "1.7.0.2", + "version": "1.7.0.3", "recommended": false, "official": true, "patchFrom": [ "1.7", - "1.7.0.1" + "1.7.0.1", + "1.7.0.2" ], "description": "The Official Meteor Distribution" }