How to manage many file test in `/tests` structure in Meteor 1.7

I have many file tests: a.test.js, b.test.js, c.test.js, and then I would like to import its in /tests structure directory of Meteor 1.7.
But don’t work

// /tests/main.js
import '../imports/api/a.test.js'

Please help me

Are you running it in test mode?

Yes, I run with npm run test-app (but npm run test is work fine).
My code

// package.json
  "name": "test1.7-2",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --once --driver-package meteortesting:mocha",
    "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
    "visualize": "meteor --production --extra-packages bundle-visualizer"
  "dependencies": {
    "@babel/runtime": "^7.0.0-beta.51",
    "meteor-node-stubs": "^0.4.1"
  "meteor": {
    "mainModule": {
      "client": "client/main.js",
      "server": "server/main.js"
    "testModule": "tests/main.js"
  "devDependencies": {
    "chai": "^4.1.2"
// meteor package
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor@1.9.0                  # Shared foundation for all Meteor packages
static-html             # Define static page content in .html files
standard-minifier-css@1.4.1   # CSS minifier run for production mode
standard-minifier-js@2.3.4    # JS minifier run for production mode
es5-shim@4.8.0                # ECMAScript 5 compatibility for older browsers
ecmascript@0.11.1              # Enable ECMAScript2015+ syntax in app code
shell-server@0.3.1            # Server-side component of the `meteor shell` command
webapp@1.6.0                  # Serves a Meteor app over HTTP
server-render@0.3.1           # Support for server-side rendering

Testing file

// imports/api/lib.test.js
import { assert } from "chai";

describe("Sum Fn", function() {
  it("should be 2", function() {
    assert.equal(2, 2);

Test moudle

// tests/main.js
import "../imports/api/lib.test.js";

Get error

W20180715-09:33:26.277(7)? (STDERR) /private/var/folders/xk/4d6f80k13pl6cdk695llf1ym0000gn/T/meteor-test-run1ox8nzp.r1ef/.meteor/local/build/programs/server/app/app.js:56
W20180715-09:33:26.277(7)? (STDERR) import { assert } from "chai";
W20180715-09:33:26.278(7)? (STDERR) ^^^^^^
W20180715-09:33:26.278(7)? (STDERR)
W20180715-09:33:26.278(7)? (STDERR) SyntaxError: Unexpected token import
W20180715-09:33:26.278(7)? (STDERR)     at createScript (vm.js:80:10)
W20180715-09:33:26.279(7)? (STDERR)     at Object.runInThisContext (vm.js:139:10)
W20180715-09:33:26.279(7)? (STDERR)     at /private/var/folders/xk/4d6f80k13pl6cdk695llf1ym0000gn/T/meteor-test-run1ox8nzp.r1ef/.meteor/local/build/programs/server/boot.js:393:30

@robfallows, Which recommendation of meteor test package (base on Vue)?
I like practicalmeteor:mocha with Server/Client mode, but it is out of date!!!

The recommendation is meteortesting:mocha.

But I have above problem npm run test-app with import .test.js file from /imports/api

Testing in Meteor has had it’s quirks for a long time. We had the same issue with imports not working in /tests so we renamed them to /specs and it runs (for package tests). You might want to try a rename.

@jamiter thanks, I will try soon.

@robfallows, how about cultofcoders:mocha?

I’ve not used it myself, but it’s reasonably up-to-date, so give it a shot. The Cult of Coders team is pretty responsive if you find any issues.

1 Like