I've created an Ember test helper, which works correctly and is used successfully in an Ember qunit test, however every time JSHint runs it always gives me an error saying my test helper is not defined.
Is there something else I need to do to register my test helper? If not, is there a way I can suppress this error in JSHint?
Here is my Ember test helper. It gives no run-time errors, my tests pass successfully, and I've even set a break point and stepped through it with the debugger so I know the JSHint error is a false positive.
Ember.Test.registerHelper('hasText', function (app, selector, text) {
...
});
This is defined in a custom.js helper file, which is being imported in the /tests/test-helper.js file that was generated for me by Ember-cli.
import resolver from './helpers/resolver';
import { setResolver } from 'ember-qunit';
import testing from './helpers/custom';
setResolver(resolver);
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
The errors I'm getting are:
.../tests/acceptance/outages-test.js: line 20, col 11, 'hasText' is not defined.
.../tests/acceptance/outages-test.js: line 22, col 10, 'hasText' is not defined.
Here is the acceptance test file (lines 20 and 22 are the two 'ok' lines near the bottom):
import Ember from 'ember';
import startApp from '../helpers/start-app';
var App;
module('Acceptance: Outages', {
setup: function() {
App = startApp();
},
teardown: function() {
Ember.run(App, 'destroy');
}
});
test('...', function() {
visit('/');
andThen(function() {
if (route('index').get('controller.outages.content').length > 0) {
ok(!hasText('.warning', 'No outages planned'), 'we have outages');
} else {
ok(hasText('.warning', 'No outages planned'), 'we have no outages');
}
});
});
I'm not sure what else I can do; I don't want these errors to keep polluting my JSHint output.
Edited to include errors and test they're occurring in.