Support for directory alias
Opened this issue · 5 comments
What happened
I tried to run the test with test.bat in this project.
The test that should be run is this:
define [
'j/app/models/Todo'
'j/app/views/items/Todo'
], (TodoModel, TodoView) ->
describe 'TodoView', ->
it 'should be toggleable', ->
testTodoView = new TodoView({
'model': new TodoModel({
'id': 0,
'done': false,
'title': 'Test'
})
})
expect(true).to.equal(true)
Mimosa watch -s compiles it fine, however, testem Runner errors out:
Uncaught Error: Script error for: j/app/views/items/Todo
http://requirejs.org/docs/errors.html#scripterror at http://localhost:7357/.mimo
sa/testemRequire/require.min.js, line 8
Uncaught Error: Script error for: j/app/models/Todo
http://requirejs.org/docs/errors.html#scripterror at http://localhost:7357/.mimo
sa/testemRequire/require.min.js, line 8
What I expected to happen
Mimosa should run the test and return true.
Thoughts
I think this is caused by baseUrl in combination of directory aliases.
This is the config for test-variables.js:
window.MIMOSA_TEST_REQUIRE_CONFIG = {
"baseUrl": "/js",
"paths": {
"app": "app",
"backbone": "vendor/backbone/backbone",
"backbone.babysitter": "vendor/backbone.babysitter/backbone.babysitter",
"backbone.localstorage": "vendor/backbone.localstorage/backbone.localStorage",
"backbone.marionette": "vendor/backbone.marionette/backbone.marionette",
"backbone.wreqr": "vendor/backbone.wreqr/backbone.wreqr",
"css": "vendor/require-css/css",
"handlebars": "vendor/handlebars/handlebars",
"hbs": "vendor/require-hbs/hbs",
"jquery": "vendor/jquery/jquery",
"require": "vendor/requirejs/require",
"semantic": "vendor/semantic/semantic",
"text": "vendor/require-text/text",
"underscore": "vendor/underscore/underscore",
"j": "../javascripts",
"c": "../stylesheets",
"t": "../templates/"
},
"shim": {
"app": {
"exports": "app"
},
"backbone": {
"deps": [
"underscore"
]
},
"backbone.babysitter": {
"deps": [
"backbone"
]
},
"backbone.localstorage": {
"deps": [
"backbone"
]
},
"backbone.marionette": {
"deps": [
"backbone",
"backbone.babysitter",
"backbone.localstorage",
"backbone.wreqr",
"jquery"
],
"exports": "Marionette"
},
"handlebars": {
"exports": "Handlebars"
},
"semantic": {
"deps": [
"jquery"
],
"exports": "semantic"
},
"underscore": {
"deps": [],
"exports": "_"
}
}
};
window.MIMOSA_TEST_MOCHA_SETUP = {
"ui": "bdd"
};
window.MIMOSA_TEST_SPECS = [
"spec/views/Todo_spec"
];
As far as I know, baseUrl does currently not work together with directory alias in Mimosa.
This one will take some time to play around with.
Could you push a satisfy branch with this all set up so I can dig in? Might not be for a few days.
You could check mimosa-marionette, it's all set up there. 👍
k!
How's it going?
It's not. Working some other mimosa relate stuff at the moment before digging into require support in a big way.
You are welcome to help out.