diff --git a/tools/commands.js b/tools/commands.js index bd8d7374ac..a4dba2a0e3 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -1249,6 +1249,11 @@ main.registerCommand({ 'selenium': { type: Boolean }, 'selenium-browser': { type: String }, + // Undocumented. Usually we just show a banner saying 'Tests' instead of + // the ugly path to the temporary test directory, but if you actually want + // to see it you can ask for it. + 'show-test-app-path': { type: Boolean }, + // hard-coded options with all known Cordova platforms ios: { type: Boolean }, 'ios-device': { type: Boolean }, @@ -1295,8 +1300,7 @@ main.registerCommand({ // run multiple "test-packages" commands in parallel without them stomping // on each other. var testRunnerAppDir = - options['test-app-path'] || files.mkdtemp('meteor-test-run'); - files.cp_r(path.join(__dirname, 'test-runner-app'), testRunnerAppDir); + options['test-app-path'] || files.mkdtemp('meteor-test-run'); // Download packages for our architecture, and for the deploy server's // architecture if we're deploying. @@ -1327,8 +1331,8 @@ main.registerCommand({ release.current.isCheckout() ? "none" : release.current.name); var packagesToAdd = getTestPackageNames(projectContext, options.args); - // Use the driver package as well. - packagesToAdd.push(options['driver-package']); + // Use the driver package and meteor-platform as well. + packagesToAdd.unshift('meteor-platform', options['driver-package']); var constraintsToAdd = _.map(packagesToAdd, function (p) { return utils.parseConstraint(p); }); @@ -1479,7 +1483,7 @@ var runTestAppForPackages = function (projectContext, options) { debugPort: options['debug-port'], disableOplog: options['disable-oplog'], settingsFile: options.settings, - banner: "Tests", + banner: options['show-test-app-path'] ? null : "Tests", buildOptions: buildOptions, rootUrl: process.env.ROOT_URL, mongoUrl: process.env.MONGO_URL, diff --git a/tools/project-context.js b/tools/project-context.js index 55dc3c4846..bb7914d500 100644 --- a/tools/project-context.js +++ b/tools/project-context.js @@ -187,6 +187,11 @@ _.extend(exports.ProjectContext.prototype, { buildmessage.assertInCapture(); buildmessage.enterJob('reading project metadata', function () { + // Ensure this is actually a project directory. + self._ensureProjectDir(); + if (buildmessage.jobHasMessages()) + return; + // Read .meteor/release. self.releaseFile = new exports.ReleaseFile({ projectDir: self.projectDir @@ -239,6 +244,24 @@ _.extend(exports.ProjectContext.prototype, { self._completedStage = STAGE.READ_PROJECT_METADATA; }, + _ensureProjectDir: function () { + var self = this; + files.mkdir_p(path.join(self.projectDir, '.meteor')); + + // This file existing is what makes a project directory a project directory, + // so let's make sure it exists! + var constraintFilePath = path.join(self.projectDir, '.meteor', 'packages'); + if (! fs.existsSync(constraintFilePath)) { + files.writeFileAtomically(constraintFilePath, ''); + } + + // Let's also make sure we have a minimal gitignore. + var gitignorePath = path.join(self.projectDir, '.meteor', '.gitignore'); + if (! fs.existsSync(gitignorePath)) { + files.writeFileAtomically(gitignorePath, 'local\n'); + } + }, + // This is a WatchSet that ends up being the WatchSet for the app's // initFromAppDir PackageSource. Changes to this will cause the whole app to // be rebuilt (client and server). @@ -311,7 +334,7 @@ _.extend(exports.ProjectContext.prototype, { var solution; buildmessage.enterJob("selecting package versions", function () { var resolveOptions = { - previousSolution: self.packageMapFile.getCachedVersions(), + previousSolution: self.packageMapFile.getCachedVersions() }; if (self._upgradePackageNames) resolveOptions.upgrade = self._upgradePackageNames; @@ -539,9 +562,12 @@ _.extend(exports.ProjectConstraintsFile.prototype, { self._constraintLines = []; var contents = watch.readAndWatchFile(self.watchSet, self.filename); - // No .meteor/packages? That's OK, you just get no packages. + // No .meteor/packages? This isn't a very good project directory. In fact, + // that's the definition of a project directory! (And that should have been + // fixed by _ensureProjectDir!) if (contents === null) - return; + throw Error("packages file missing: " + self.filename); + var lines = files.splitBufferToLines(contents); // Don't keep a record for the space at the end of the file. if (lines.length && _.last(lines) === '') diff --git a/tools/test-runner-app/.meteor/.gitignore b/tools/test-runner-app/.meteor/.gitignore deleted file mode 100644 index 4083037423..0000000000 --- a/tools/test-runner-app/.meteor/.gitignore +++ /dev/null @@ -1 +0,0 @@ -local diff --git a/tools/test-runner-app/.meteor/packages b/tools/test-runner-app/.meteor/packages deleted file mode 100644 index 006a126776..0000000000 --- a/tools/test-runner-app/.meteor/packages +++ /dev/null @@ -1,4 +0,0 @@ -# In addition to the standard app packages, a driver package will be added by -# "meteor test-packages". - -standard-app-packages