Now both test-app and test-packages work

This commit is contained in:
Avital Oliver
2016-02-16 08:27:00 -08:00
parent 0deeda7be2
commit 4592c74a60
3 changed files with 31 additions and 21 deletions

View File

@@ -350,12 +350,12 @@
"babel-plugin-transform-runtime": {
"version": "6.4.3"
},
"ansi-regex": {
"version": "2.0.0"
},
"amdefine": {
"version": "1.0.0"
},
"ansi-regex": {
"version": "2.0.0"
},
"ansi-styles": {
"version": "2.1.0"
},
@@ -404,15 +404,15 @@
"babel-template": {
"version": "6.3.13"
},
"babel-traverse": {
"version": "6.4.5"
},
"babel-types": {
"version": "6.4.5"
},
"balanced-match": {
"version": "0.3.0"
},
"babel-traverse": {
"version": "6.4.5"
},
"brace-expansion": {
"version": "1.1.2"
},
@@ -425,12 +425,12 @@
"core-js": {
"version": "1.2.6"
},
"debug": {
"version": "2.2.0"
},
"detect-indent": {
"version": "3.0.1"
},
"debug": {
"version": "2.2.0"
},
"escape-string-regexp": {
"version": "1.0.4"
},
@@ -473,12 +473,12 @@
"line-numbers": {
"version": "0.2.0"
},
"lodash": {
"version": "3.10.1"
},
"loose-envify": {
"version": "1.1.0"
},
"lodash": {
"version": "3.10.1"
},
"minimatch": {
"version": "2.0.10"
},
@@ -536,12 +536,12 @@
"to-fast-properties": {
"version": "1.0.1"
},
"trim-right": {
"version": "1.0.1"
},
"user-home": {
"version": "1.1.1"
},
"trim-right": {
"version": "1.0.1"
},
"mkdirp": {
"version": "0.5.1",
"dependencies": {

View File

@@ -463,9 +463,7 @@ function doTestCommand(options) {
//
// As long as the Meteor CLI runs a single command as part of each
// process, this should be safe.
global.testCommandMetadata = {
driverPackage: options['driver-package']
};
global.testCommandMetadata = {};
Console.setVerbose(!!options.verbose);
@@ -497,6 +495,7 @@ function doTestCommand(options) {
var projectContext;
if (options["test-packages"]) {
global.testCommandMetadata.driverPackage = options['driver-package'];
projectContextOptions.projectDir = testRunnerAppDir;
projectContextOptions.projectDirForLocalPackages = options.appDir;
@@ -566,7 +565,9 @@ function doTestCommand(options) {
// projectContext.reset.
projectContext.projectConstraintsFile.writeIfModified();
} else if (options["test-app"]) {
// XXX copy existing app build directory before, for faster builds?
// XXX look in package list for testOnly packages
global.testCommandMetadata.driverPackage = 'practicalmeteor:mocha';
projectContextOptions.projectDir = options.appDir;
projectContextOptions.projectLocalDir = files.pathJoin(testRunnerAppDir, '.meteor', 'local');

View File

@@ -965,11 +965,20 @@ export var fullLink = Profile("linker.fullLink", function (inputFiles, {
// XXX pass in test driver package from CLI
var weAreLinkingTheApp = (name === null);
if (weAreLinkingTheApp) {
var testDriverPackageName = global.testCommandMetadata.driverPackage;
prelinkedFiles.push({
source: `\
setTimeout(function() {
var runTestsFunc = Package[\"${global.testCommandMetadata.driverPackage}\"].runTests;
runTestsFunc && runTestsFunc(); // Only run on browser where runTests is defined
var testDriverPackage = Package[\"${testDriverPackageName}\"];
if (!testDriverPackage) {
throw new Error(\"Can\'t find test driver package: ${testDriverPackageName}\");
}
// Only run on browser where runTests is defined
if (testDriverPackage.runTests) {
testDriverPackage.runTests();
}
}, 0);`,
servePath: "/packages/runTests.js"
});