lundi 24 août 2015

Ember Hello Word - Test Error in http://localhost:4200/tests but not in command line

I am trying to build a hello world Ember.js app by following this tutorial...I have gotten to the part where I test the link to an About page.

My setup is:

QUnit 1.18.0; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
Ember version: 1.13.8
node: 0.12.7
npm: 2.13.4
os: darwin x64

My router.js is:

import Ember from 'ember';
import config from './config/environment';

var Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('about');
});

export default Router;

My application.hbs is:

<h2 id="title">Welcome to Boston Ember</h2>

{{link-to 'About' 'about'}}

{{outlet}}

My about.hbs is:

<h3>About</h3>

<p>Boston Ember is the monthly meetup where awesome people get together

to do awesome Ember related things!

My about-page-test.js is:

import Ember from 'ember';
import startApp from 'bostonember/tests/helpers/start-app';

var App;

module('Integration - About Page', {
  beforeEach: function() {
    App = startApp();
  },
  afterEach: function() {
    Ember.run(App, 'destroy');
  }
});

test('Should navigate to the About page', function() {
  visit('/').then(function(assert) {
    click("a:contains('About')").then(function(assert) {
      assert.equal(find('h3').text(), 'About');
    });
  });
});

The page functions as it should and the command line does not return any errors:

file changed templates/application.hbs

Build successful - 691ms.

But when I go to http://localhost:4200/tests I see a bunch of errors...

Integration - About Page: Should navigate to the About page (1, 0, 1)Rerun210 ms
TypeError: Cannot read property 'equal' of undefined@ 190 ms
Expected:   true
Result:     false
Diff:   trufalse
Source:     
    at http://localhost:4200/assets/test-support.js:4578:13
    at exports.default._emberTestingAdaptersAdapter.default.extend.exception (http://localhost:4200/assets/vendor.js:52460:34)
    at onerrorDefault (http://localhost:4200/assets/vendor.js:43162:24)
    at Object.exports.default.trigger (http://localhost:4200/assets/vendor.js:67346:11)
    at Promise._onerror (http://localhost:4200/assets/vendor.js:68312:22)
    at publishRejection (http://localhost:4200/assets/vendor.js:66619:15)

JSHint - integration: integration/about-page-test.js should pass jshint (1, 0, 1)Rerun1 ms
integration/about-page-test.js should pass jshint.
integration/about-page-test.js: line 6, col 1, 'module' is not defined.
integration/about-page-test.js: line 15, col 1, 'test' is not defined.
integration/about-page-test.js: line 16, col 28, 'assert' is defined but never used.

3 errors@ 0 ms
Expected:   true
Result:     false
Diff:   trufalse
Source:     
    at Object.<anonymous> (http://localhost:4200/assets/bostonember.js:337:12)
    at Object.Test.run (http://localhost:4200/assets/test-support.js:3566:28)
    at http://localhost:4200/assets/test-support.js:3695:11
    at process (http://localhost:4200/assets/test-support.js:3254:24)
    at begin (http://localhost:4200/assets/test-support.js:3299:2)
    at http://localhost:4200/assets/test-support.js:3315:4

I have tried using some different variations of this.route('about'); although I think this is fine, since the functionality works. I have also tried some different things in the test, but nothing gets rid of the browser error.




Aucun commentaire:

Enregistrer un commentaire