This is an interesting situation.
The puzzle is this: The component's name is TODO
Controller.js
import Component from 'component';
import View from 'app-folder/components/todo/view';
export default Component.extend({
viewClass: View
});
View.js
import {LayoutView} from 'backbone.marionette';
import template from 'app-folder/components/todo/template';
export default LayoutView.extend({
template: template
});
I am using Karma, webpack & tape to test out the components. I'm not putting all the functions within the view and component, because it is not necessary for this question. However the question is simple & complex: How do you deal with absolute path restrictions in an application for doing unit testing
so example:
import test from 'tape';
import controller from 'app-folder/components/todo/controller'
test('testing something', (t) => {
t.end();
});
It will return this type of error:
ERROR in ./components/todo/tests/todo_spec.js
Module not found: Error: Cannot resolve module 'app-folder/components/todo/controller' in /Users/username/Documents/projects/app-folder/components/todo/tests
Because of the path being all weird. Now I wish I could do relative pathing to solve this issue... but due to how it's built, its not possible.
I can't wrap my head around it and definitely having some trouble figuring this one out.
Thanks ahead of time for any advice given!