-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
Description
Issue Description
When I open node and type following commands (same as inside server.js) I get following error:
$ node
> const TrailsApp = require('trails');
undefined
> const app = require('./');
undefined
> const server = new TrailsApp(app);
TypeError: Cannot read property 'filename' of undefined
at Function.buildConfig (/node_modules/trails/lib/Configuration.js:58:52)
at new Configuration (/node_modules/trails/lib/Configuration.js:16:31)
at TrailsApp (/horizon-core/node_modules/trails/index.js:61:16)
at repl:1:16
at sigintHandlersWrap (vm.js:22:35)
at sigintHandlersWrap (vm.js:73:12)
at ContextifyScript.Script.runInThisContext (vm.js:21:12)
at REPLServer.defaultEval (repl.js:340:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:538:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:188:7)
at REPLServer.Interface._onLine (readline.js:233:10)
at REPLServer.Interface._line (readline.js:585:8)
at REPLServer.Interface._ttyWrite (readline.js:862:14)
When I run node server.js everything is fine. It is because require.main is not defined when node is running without a script being specified. Is is an expected behaviour? It is causing us headaches when we try to use Jest for testing.
Environment
- node version: v6.11.0
- trails version: v2-latest
- operating system: OSX Sierra 10.12
Reactions are currently unavailable