maybe get self-test working on releases

This commit is contained in:
David Glasser
2014-02-06 11:17:12 -08:00
parent aabed4665c
commit 37ccddede2
2 changed files with 14 additions and 0 deletions

View File

@@ -115,6 +115,9 @@ release.usingRightReleaseForApp = function (appDir) {
release.latestDownloaded = function () {
if (! files.usesWarehouse())
throw new Error("called from checkout?");
// For self-test only.
if (process.env.METEOR_TEST_LATEST_RELEASE)
return process.env.METEOR_TEST_LATEST_RELEASE;
var ret = warehouse.latestRelease();
if (! ret)
throw new Error("no releases available?");

View File

@@ -386,6 +386,11 @@ _.extend(Sandbox.prototype, {
env.METEOR_SESSION_FILE = path.join(self.root, '.meteorsession');
if (self.warehouse)
env.METEOR_WAREHOUSE_DIR = self.warehouse;
// By default (ie, with no mock warehouse and no --release arg) we should be
// testing the actual release this is built in, so we pretend that it is the
// latest release.
if (!self.warehouse && release.current.isProperRelease())
env.METEOR_TEST_LATEST_RELEASE = release.current.name;
return new Run(self.execPath, {
sandbox: self,
@@ -410,6 +415,12 @@ _.extend(Sandbox.prototype, {
var self = this;
files.cp_r(path.join(__dirname, 'tests', 'apps', template),
path.join(self.cwd, to));
// If the test isn't explicitly managing a mock warehouse, ensure that apps
// run with our release by default.
if (!self.warehouse && release.current.isProperRelease()) {
self.write(path.join(self.cwd, to, '.meteor/release'),
release.current.name);
}
},
// Change the cwd to be used for subsequent runs. For example: