jeudi 19 juillet 2018

What does "Cannot destructure property `owner` of 'undefined' or 'null'." mean and how do I combat it when running acceptance tests in Ember.JS

I'm running acceptance tests on Ember.JS 2.16 and I keep getting this error.

On localhost:4200/tests

Died on test #1     at Module.callback (http://localhost:4200/assets/tests.js:26:19)
    at Module.exports (http://localhost:4200/assets/vendor.js:111:32)
    at requireModule (http://localhost:4200/assets/vendor.js:32:18)
    at TestLoader.require (http://localhost:4200/assets/test-support.js:10741:9)
    at TestLoader.loadModules (http://localhost:4200/assets/test-support.js:10734:14)
    at loadTests (http://localhost:4200/assets/test-support.js:12393:22)
    at start (http://localhost:4200/assets/test-support.js:12143:33): Cannot destructure property `owner` of 'undefined' or 'null'.

TypeError: Cannot destructure property `owner` of 'undefined' or 'null'.
    at visit (http://localhost:4200/assets/test-support.js:9653:21)
    at Object.<anonymous> (http://localhost:4200/assets/tests.js:27:28)
    at runTest (http://localhost:4200/assets/test-support.js:4276:30)
    at Test.run (http://localhost:4200/assets/test-support.js:4262:6)
    at http://localhost:4200/assets/test-support.js:4483:12
    at advanceTaskQueue (http://localhost:4200/assets/test-support.js:3875:6)
    at advance (http://localhost:4200/assets/test-support.js:3856:4)
    at advanceTestQueue (http://localhost:4200/assets/test-support.js:3901:4)
    at Object.advance (http://localhost:4200/assets/test-support.js:3859:5)
    at begin (http://localhost:4200/assets/test-support.js:5881:20)

And this is the test..

import { test } from 'qunit';
import { visit, currentURL, andThen } from '@ember/test-helpers';
import moduleForAcceptance from '../helpers/module-for-acceptance';

moduleForAcceptance('Acceptance | basic');

test('find /plans', function(assert) {
  visit('/plans');

  andThen(function() {
    assert.equal(currentURL(), '/plans');
  });
});

It's pretty basic and I followed the guide from https://guides.emberjs.com/v2.16.0/testing/acceptance/

I'm not sure what this error means or how to combat it, any bit of information helps. Thanks.




Aucun commentaire:

Enregistrer un commentaire