CircleCi + Mocha: Cannot find module


#1

I’ve set up circleci to unit test with mocha on the server. I was wondering why absolute imports don’t work like this

import AddLocation from '/server/Routes/AddLocation'

The error on circleci is this:

#!/bin/bash -eo pipefail
meteor test --once --driver-package meteortesting:mocha
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
WARNING: The `text-hide()` mixin has been deprecated as of v4.1.0. It will be removed entirely in v5.
         on line 10 of mixins/text-hide, in mixin `text-hide`
         from line 57 of utilities/text
         from line 14 of utilities
         from line 41 of {}/node_modules/bootstrap/scss/bootstrap.scss

W20180928-14:53:25.208(0)? (STDERR) /home/circleci/.meteor/packages/meteor-tool/.1.7.0_5.r5qyn1.b1gbd++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20180928-14:53:25.287(0)? (STDERR) 						throw(ex);
W20180928-14:53:25.287(0)? (STDERR) 						^
W20180928-14:53:25.288(0)? (STDERR) 
W20180928-14:53:25.288(0)? (STDERR) Error: Cannot find module '/server/Routes/AddLocation'
W20180928-14:53:25.288(0)? (STDERR)     at makeMissingError (packages/modules-runtime.js:208:12)
W20180928-14:53:25.288(0)? (STDERR)     at Module.require (packages/modules-runtime.js:227:17)
W20180928-14:53:25.289(0)? (STDERR)     at require (packages/modules-runtime.js:244:21)
W20180928-14:53:25.289(0)? (STDERR)     at SaveRoute.js (server/Routes/Calls/SaveRoute.js:1:670)
W20180928-14:53:25.289(0)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:322:7)
W20180928-14:53:25.289(0)? (STDERR)     at Module.require (packages/modules-runtime.js:224:14)
W20180928-14:53:25.290(0)? (STDERR)     at require (packages/modules-runtime.js:244:21)
W20180928-14:53:25.290(0)? (STDERR)     at routes.test.js (test/server/routes.test.js:1:691)
W20180928-14:53:25.290(0)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:322:7)
W20180928-14:53:25.290(0)? (STDERR)     at Module.require (packages/modules-runtime.js:224:14)
W20180928-14:53:25.291(0)? (STDERR)     at require (packages/modules-runtime.js:244:21)
W20180928-14:53:25.291(0)? (STDERR)     at /tmp/meteor-test-run1w9firq.4odd/.meteor/local/build/programs/server/app/app.js:4274:1
W20180928-14:53:25.291(0)? (STDERR)     at /tmp/meteor-test-run1w9firq.4odd/.meteor/local/build/programs/server/boot.js:411:36
W20180928-14:53:25.291(0)? (STDERR)     at Array.forEach (<anonymous>)
W20180928-14:53:25.292(0)? (STDERR)     at /tmp/meteor-test-run1w9firq.4odd/.meteor/local/build/programs/server/boot.js:220:19
W20180928-14:53:25.292(0)? (STDERR)     at /tmp/meteor-test-run1w9firq.4odd/.meteor/local/build/programs/server/boot.js:471:5
W20180928-14:53:25.292(0)? (STDERR)     at Function.run (/tmp/meteor-test-run1w9firq.4odd/.meteor/local/build/programs/server/profile.js:510:12)
W20180928-14:53:25.348(0)? (STDERR)     at /tmp/meteor-test-run1w9firq.4odd/.meteor/local/build/programs/server/boot.js:470:11
=> Started your app.

=> App running at: http://localhost:3000/
Exited with code 1

Circle CI config: https://pastebin.com/raw/qkkqb5ti

Follow up question. How to generate coverage for the tests?