Unit testing modules in app/utils for an ember-cli app

Calling moduleFor on "util:transforms" appears to work,
however .subject is undefined.

The test file that I have got so far is:

  • How to check if a Promise is pending
  • Methods in ES6 objects: using arrow functions
  • braces around params — why?
  • ES6 Promises/calling a function after multiple promises are fulfilled (can't use Promises.all)
  • Associative arrays - ES6
  • How for…of Loop Statement Works in Javascript?(ECMAScript 6)
  • import { test, moduleFor } from 'ember-qunit';
    import TransformUtil from 'myapp/utils/transforms';
    moduleFor('util:transforms', "Unit - TransformUtil");
    test("Exists", function(){
      ok(this.subject() instanceof TransformUtil);

    Doing the same thing for other type of modules,
    e.g. "routes:index", appears to work without issue;
    the app/utils folder appears to be treated differently.

  • What is the reason to allow multiple resolve/reject in ES6 Promise
  • Cannot call a method within a class it defined it in ES6 in Node.js
  • Array.from() vs spread syntax
  • Which Typescript Features are Not Implemented in ES6?
  • ES6 arrow losing enclosing scope
  • JSDoc: arrow function params
  • One Solution collect form web for “Unit testing modules in app/utils for an ember-cli app”

    Utilities (app/utils) are not identified by the resolver, so you need to do a manual import. As the Ember CLI documentation states:

    All modules in the app directory can be loaded by the resolver but typically classes such as mixins and utils should be loaded manually with an import statement.

    So you should remove the first parameter to moduleFor and then just use the imported TransformUtil object in your tests.