Assertion Failed: A helper named 'my-component' could not be found


#1

Hello,

I’ve got an ember-cli app and try to test it the first time. The component was created with ember g component bs-slider.

When I run the tests (http://localhost:4200/tests) I get the following result:

Died on test #2     at Object.test (http://localhost:4200/assets/test-support.js:1984:11)
    at http://localhost:4200/assets/client.js:5732:15
    at mod.state (http://localhost:4200/assets/vendor.js:150:29)
    at tryFinally (http://localhost:4200/assets/vendor.js:30:14)
    at requireModule (http://localhost:4200/assets/vendor.js:148:5)
    at Object.TestLoader.require (http://localhost:4200/assets/test-loader.js:29:9)
    at Object.TestLoader.loadModules (http://localhost:4200/assets/test-loader.js:21:18): Assertion Failed: A helper named 'bs-slider' could not be found

Since I’m using pods the component files are located under app/pods/components/bs-slider/[component.js|template.hbs] The test file is located under tests/integration/pods/components/bs-slider/component-test.js with the following content (right from the blueprint):

import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('bs-slider', 'Integration | Component | bs slider', {
  integration: true
});

test('it renders', function(assert) {
  assert.expect(2);

  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs`{{bs-slider}}`);

  assert.equal(this.$().text().trim(), '');

  // Template block usage:
  this.render(hbs`
    {{#bs-slider}}
      template block text
    {{/bs-slider}}
  `);

  assert.equal(this.$().text().trim(), 'template block text');
});

Is there anything I can do to tell the test framework where the component is located?

Kind regards haggis


#2

I am also facing the same problem inside ember-addon test cases. Does anybody have any ideas ? Kindly guide me. Thanks in advance.


#3

Any update on this one?


#4

I don’t use pods, but shouldn’t the path be:

app/pods/bs-slider/[component.js|template.hbs]

Or perhaps:

app/bs-slider/[component.js|template.hbs]


#5

bump.

Any update on this issue?


#6

Remove below set of code and re-render

this.render(hbs{{#bs-slider}} template block text {{/bs-slider}});

assert.equal(this.$().text().trim(), ‘template block text’);


#7

The path to your pods is determined in the config/environment.js using podModulePrefix property. See this blog post here

I believe the default path to pods is just app/.


#8

It helped…Thank a lot