Sha256: 554a41253e5ca88ec46e205ab62db6a89a11ccfa51413615e38e730ae62f7c0a

Contents?: true

Size: 970 Bytes

Versions: 2

Compression:

Stored size: 970 Bytes

Contents

import { Container } from 'container';

function ContainersAssert(env) {
  this.env = env;
}

const { _leakTracking: containerLeakTracking } = Container;

ContainersAssert.prototype = {
  reset: function() {},
  inject: function() {},
  assert: function() {
    if (containerLeakTracking === undefined) return;
    let { config } = QUnit;
    let { testName, testId, module: { name: moduleName }, finish: originalFinish } = config.current;
    config.current.finish = function() {
      originalFinish.call(this);
      originalFinish = undefined;
      config.queue.unshift(function() {
        if (containerLeakTracking.hasContainers()) {
          containerLeakTracking.reset();
          // eslint-disable-next-line no-console
          console.assert(
            false,
            `Leaked container after test ${moduleName}: ${testName} testId=${testId}`
          );
        }
      });
    };
  },
  restore: function() {},
};

export default ContainersAssert;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/internal-test-helpers/lib/ember-dev/containers.js
discourse-ember-source-3.5.1.0 dist/dist/es/internal-test-helpers/lib/ember-dev/containers.js