flatiron / director

a tiny and isomorphic URL router for JavaScript

Home Page:http://github.com/flatiron/director

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different methods on client-side router when run in Node.js

dchambers opened this issue · comments

I'd like to test my application using Mocha running on Node.js. This mostly works except for the routing, since require('director').Router.prototype has less methods when run in Node.js than it does when run in a browser.

Whereas in the browser I get these methods:

init: function (r) { ... },
explode: function () { ... },
setRoute: function (i, v, val) { ... },
insertEx: function (method, path, route, parent) { ... },
getRoute: function (v) { ... },
destroy: function () { ... },
getPath: function () { ... },
configure: function (options) { ... },
param: function (token, matcher) { ... },
route: function (method, path, route) { ... },
on: function (method, path, route) { ... },
path: function (path, routesFn) { ... },
dispatch: function (method, path, callback) { ... },
invoke: function (fns, thisArg, callback) { ... },
traverse: function (method, path, routes, regexp, filter) { ... },
insert: function (method, path, route, parent) { ... },
extend: function (methods) { ... },
runlist: function (fns) { ... },
mount: function (routes, path) { ... }

in Node.js (with jsdom included) I only get these methods:

configure: [Function],
param: [Function],
route: [Function],
on: [Function],
path: [Function],
dispatch: [Function],
runlist: [Function],
invoke: [Function],
traverse: [Function],
insert: [Function],
extend: [Function],
mount: [Function]

Is there a correct way to get the same behaviour when using the client-side router in Node.js?