Skip to content

Share 'before' hook test environment with child module #1328

@ming-codes

Description

@ming-codes

Tell us about your runtime:

  • QUnit version: 2.6.2
  • What environment are you running QUnit in? (e.g., browser, Node): browser
  • How are you running QUnit? (e.g., script, testem, Grunt): ember-qunit

What are you trying to do?

module('parent', function(hooks) {
  hooks.before(function() {
    this.hello = 'world';
  });

  test('outer', function(assert) {
    assert.equal(this.hello, 'world'); // pass
  });

  module('child', function() {
    test('inner', function(assert) {
      assert.equal(this.hello, 'world'); // fails
    });
  });
});

What did you expect to happen?

Expecting nested child modules to share test environment with parent module.

What actually happened?

Nested child module have it's own test environment object.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions