Testing react with jasmine, tell meteor to ignore spec.js

My dir structure looks like this

  |- client
    |- enums
      |- blah.js
  |- server
  | spec
    |- testSpec.js

In testSpec.js, I import enums like this:
import blah from '..\client\enums\blah.js'

When I run my jasmine tests using my Karma runner, everything is fine.

However, meteor also picks up testSpec.js but it can’t seem to resolve the import. My first thought is that it doesn’t need to worry about the directory at all. How do I get meteor to ignore the spec directory?

the tests folder is currently ignored - just rename it. Or use an imports based structure where files are not eagerly loaded.

1 Like

I renamed the folder to tests but then I get this weird error which google doesn’t seem to have a good answer to.
It’s only there if I rename it to tests:

20160319-11:22:16.070(11)? (STDERR) /home/mordrax/.meteor/packages/meteor-tool/.1.1.13-beta.12.1yby4x9++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:267
W20160319-11:22:16.070(11)? (STDERR)            				throw(ex);
W20160319-11:22:16.070(11)? (STDERR)            				      ^
W20160319-11:22:16.454(11)? (STDERR) Error: Cannot find module './base64-vlq'
W20160319-11:22:16.454(11)? (STDERR)     at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:85:1)
W20160319-11:22:16.454(11)? (STDERR)     at stringRequire (node_modules/amdefine/amdefine.js:220:1)
W20160319-11:22:16.454(11)? (STDERR)     at amdRequire (node_modules/amdefine/amdefine.js:113:1)
W20160319-11:22:16.454(11)? (STDERR)     at Object.<anonymous> (node_modules/webpack-core/node_modules/source-map/lib/source-map/source-map-generator.js:12:1)
W20160319-11:22:16.454(11)? (STDERR)     at runFactory (node_modules/amdefine/amdefine.js:183:1)
W20160319-11:22:16.454(11)? (STDERR)     at define (node_modules/amdefine/amdefine.js:277:1)
W20160319-11:22:16.454(11)? (STDERR)     at meteorInstall.node_modules.webpack-core.node_modules.source-map.lib.source-map.source-map-generator.js (node_modules/webpack-core/node_modules/source-map/lib/source-map/source-map-generator.js:10:1)
W20160319-11:22:16.455(11)? (STDERR)     at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:176:1)
W20160319-11:22:16.455(11)? (STDERR)     at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
W20160319-11:22:16.455(11)? (STDERR)     at meteorInstall.node_modules.webpack-core.node_modules.source-map.lib.source-map.js (node_modules/webpack-core/node_modules/source-map/lib/source-map.js:6:1)


It was because I still had the karma.conf.js and test.webpack.js outside of the tests folder. Once moved in, meteor ignores all of it and I just use karma-cli to karma start the unit tests all within the folder, works as expected. Thanks for your help.