Skip to content

Implement RFC 232 (New QUnit Testing API) #208

@rwjblue

Description

@rwjblue

I would like to support nested modules, but I am unsure of the exact API.

Current front runner:

import { moduleFor, test } from 'ember-qunit';
import { module } from 'qunit';

moduleFor('foo:bar', function(hooks) {
  hooks.beforeEach(function(assert) {
    // any before each code needed
  });

  test('some non-nested test', function(assert) {
    // stuff here
  });

  module('additional grouping', function(hooks) {
    hooks.beforeEach(function(assert) {
      // setup that is specific to `additional grouping` module
    });

    test('some test name here', function(assert) {
      // stuff
    });
  });
});

Random thoughts:

  • I'm not terribly happy with the above example having to import module from qunit and moduleFor from ember-qunit. I suppose I could expose module from ember-qunit, but this is something that we have avoided so far....
  • I'd like to forbid nested moduleFor invocations. If you are testing two different modules, IMHO, you should be using different test files. I am uncertain how you could stack two moduleFor calls anyways (because both of their setups would try to "own" the test context and whatnot). Need to determine how to detect that we are being called in a nested context...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions