Skip to content

Commit

Permalink
Use meteor.{mainModule,testModule} for meteor create starter apps.
Browse files Browse the repository at this point in the history
In order for Meteor to maintain its commitment to being a
zero-configuration tool, any configuration options that we add must come
pre-configured in the best way possible for newly created apps.

In particular, the default new Meteor app must contain a reasonable
testing story, or else we are signalling to the community that testing is
an afterthought.

With that said, this PR is still a work in progress. I welcome your
feedback on how best to configure the default `meteor create` starter app.

Builds on #9690 and #9714.
  • Loading branch information
Ben Newman committed Mar 1, 2018
1 parent a770e99 commit d557078
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/static-assets/skel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
"name": "~name~",
"private": true,
"scripts": {
"start": "meteor run"
"start": "meteor run",
"test": "meteor test --driver-package dispatch:mocha-browser",
"test-app": "meteor test --full-app --driver-package dispatch:mocha-browser",
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.36",
"@babel/runtime": "^7.0.0-beta.40",
"meteor-node-stubs": "^0.3.2"
},
"meteor": {
"mainModule": {
"client": "client/main.js",
"server": "server/main.js"
},
"testModule": "test/main.js"
}
}
27 changes: 27 additions & 0 deletions tools/static-assets/skel/test/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import assert from "assert";

export const testMessage = "Welcome to Meteor!";

describe("~name~", () => {
it("package.json has correct name", () => {
const { name } = require("../package.json");
assert.strictEqual(name, "~name~");
});

if (Meteor.isClient) {
it("client is not server", () => {
assert.strictEqual(Meteor.isServer, false);
});
}

if (Meteor.isServer) {
it("server is not client", () => {
assert.strictEqual(Meteor.isClient, false);
});
}

it("async/await and dynamic import()", async () => {
const tests = await import("./main.js");
assert.strictEqual(tests.testMessage, testMessage);
});
});

0 comments on commit d557078

Please sign in to comment.