Skip to content

Commit

Permalink
Give package test modules access to Npm.depends dependencies.
Browse files Browse the repository at this point in the history
Similar in spirit to bbac272.

Fixes meteor#7999.
  • Loading branch information
Ben Newman committed Nov 8, 2016
1 parent e1e3c89 commit 8f07a87
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
[#7154](https://github.com/meteor/meteor/issues/7154)
[#7956](https://github.com/meteor/meteor/issues/7956)
[#7974](https://github.com/meteor/meteor/issues/7974)
[#7999](https://github.com/meteor/meteor/issues/7999)
[#8005](https://github.com/meteor/meteor/issues/8005)
[#8007](https://github.com/meteor/meteor/issues/8007)

Expand Down
7 changes: 6 additions & 1 deletion tools/isobuild/import-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,12 @@ export default class ImportScanner {
if (this.name) {
// If we're bundling a package, prefix path with
// node_modules/<package name>/.
path = pathJoin("node_modules", "meteor", this.name, path);
path = pathJoin(
"node_modules",
"meteor",
this.name.replace(/^local-test[:_]/, ""),
path,
);
}

// Install paths should always be delimited by /.
Expand Down
3 changes: 2 additions & 1 deletion tools/tests/apps/modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"winston": "^2.2.0"
},
"scripts": {
"test": "METEOR_PROFILE=100 ../../../../meteor test --full-app --driver-package avital:mocha"
"test": "METEOR_PROFILE=100 ../../../../meteor test --full-app --driver-package avital:mocha",
"test-packages": "../../../../meteor test-packages --driver-package avital:mocha packages/modules-test-package"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Package.describe({

Npm.depends({
"os-browserify": "0.2.0",
"assert": "1.3.0"
"assert": "1.3.0",
"cheerio": "0.22.0"
});

Package.onUse(function(api) {
Expand All @@ -17,3 +18,10 @@ Package.onUse(function(api) {
api.mainModule("server.js", "server");
api.export("ModulesTestPackage");
});

Package.onTest(function (api) {
api.use("ecmascript");
api.use("tinytest");
api.use("modules-test-package");
api.mainModule("tests.js");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import assert from "assert";

describe("cheerio", () => {
it("should be importable", () => {
import cheerio from "cheerio";
assert.strictEqual(typeof cheerio, "object");
assert.deepEqual(Object.keys(cheerio), ["cheerio"]);
});
});

0 comments on commit 8f07a87

Please sign in to comment.