Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky Cannot assign to read only property 'owner' of object '#<Context>' #561

Open
rreckonerr opened this issue May 13, 2020 · 2 comments
Open

Comments

@rreckonerr
Copy link

Cannot assign to read only property 'owner' of object '#<Context>'

I'm upgrading test suit from ember-cli-mocha to ember-mocha 0.15.1 and get randomly failing tests all over again and those tests look fine when I'm running them separately. Is there a way to find out what's causing this error?

@rreckonerr
Copy link
Author

Mentioned error appears because of some tests being started before the previous one is finished, which results in tests getting wrong originalContext and not being able to clean it up properly. Is my assumption correct? Any ideas how can I debug this further?

  beforeEach(function () {
    originalContext = _assign({}, this);
    console.group(
      `${originalContext.test.parent.title} => ${originalContext.currentTest.title}`
    );
    return setupContext(this, options)
      .then(() => setupPauseTest(this))
      .then(() => chainHooks(beforeEachHooks, this));
  });

  afterEach(function () {
    return chainHooks(afterEachHooks, this)
      .then(() => teardownContext(this))
      .then(() => {
        // delete any extraneous properties
        for (let key in this) {
          if (!(key in originalContext)) {
            console.log("key to delete :>> ", key);
            delete this[key];
          }
        }

        // copy over the original values
        _assign(this, originalContext);
      })
      .catch((error) => {
        console.log("this :>> ", this);
        console.log("originalContext :>> ", originalContext);
        console.error(error);
      })
      .finally(() => {
        console.groupEnd();
      });
  });

image

Example in the screenshot is failing randomly.

@notchris
Copy link

notchris commented Jun 3, 2021

Can confirm this issue occurs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants