jeudi 23 avril 2015

Ember-CLI tests can't include modules from 'app' directory

I am trying to include a module in my app from one of the tests. Is it even possible to do that? I am only able to include a module in the 'tests' directory. I keep getting the infamous "Could not find module" error.

http://localhost:4200/assets/test-support.js:5578:16: Could not find module d3graph/app/controllers/index imported from d3graph/tests/unit/utils/graph-helper-test

This is my test code:

import { moduleFor, test }  from 'ember-qunit';
import Ember from 'ember';
import helper from '../../../app/controllers/index';  // <- THIS LINE FAILS

moduleFor('util:graph-helper', 'Graph Helper', {
  beforeEach: () => initialize()
});

function initialize() { /* something */ };

test('test desc', function(assert) {
  var testObj = this.subject();

  // test logic follows
});

I did try various modifications of the path to the module, including absolute path from root, I even tried including via 'require()', but alas without success. Please help.




Aucun commentaire:

Enregistrer un commentaire