Skip to content

Commit

Permalink
Make --prepare-app install default npm deps to fix self-tests.
Browse files Browse the repository at this point in the history
Tests were broken by the new dependency on the babel-runtime npm
package, but fortunately all those tests run `meteor --prepare-app`
whenever an app is created by a self-test, so this change should fix
most of the breakages.
  • Loading branch information
Ben Newman committed Nov 2, 2016
1 parent f035527 commit 10f997a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tools/cli/commands-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,17 @@ main.registerCommand({
'allow-incompatible-update': { type: Boolean }
}
}, function (options) {
require("./commands.js").installDefaultNpmDeps(options.appDir);

var projectContext = new projectContextModule.ProjectContext({
projectDir: options.appDir,
allowIncompatibleUpdate: options['allow-incompatible-update']
});

main.captureAndExit("=> Errors while initializing project:", function () {
projectContext.prepareProjectForBuild();
});

projectContext.packageMapDelta.displayOnConsole();
});

Expand Down
8 changes: 4 additions & 4 deletions tools/cli/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ function doTestCommand(options) {
projectContextOptions.projectDir = testRunnerAppDir;
projectContextOptions.projectDirForLocalPackages = options.appDir;

installDefaultNpmDepsForTestPackages(testRunnerAppDir);
installDefaultNpmDeps(testRunnerAppDir);
if (buildmessage.jobHasMessages()) {
return;
}
Expand Down Expand Up @@ -1717,9 +1717,9 @@ function doTestCommand(options) {
));
}

function installDefaultNpmDepsForTestPackages(testRunnerAppDir) {
export function installDefaultNpmDeps(appDir) {
const testAppPkgJsonPath =
files.pathJoin(testRunnerAppDir, "package.json");
files.pathJoin(appDir, "package.json");

if (files.statOrNull(testAppPkgJsonPath)) {
// Do nothing if the test directory already has a package.json file,
Expand All @@ -1740,7 +1740,7 @@ function installDefaultNpmDepsForTestPackages(testRunnerAppDir) {
"utf8",
);

const installResult = runNpmCommand(["install"], testRunnerAppDir);
const installResult = runNpmCommand(["install"], appDir);
if (! installResult.success) {
buildmessage.error(
"Could not install npm dependencies for test-packages: " +
Expand Down

0 comments on commit 10f997a

Please sign in to comment.