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


i trying build hello world ember.js app following this tutorial...i have gotten part test link page.

my setup is:

qunit 1.18.0; mozilla/5.0 (macintosh; intel mac os x 10_10_3) applewebkit/537.36 (khtml, 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 'ember'; import config './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 boston ember</h2>  {{link-to 'about' 'about'}}  {{outlet}} 

my about.hbs is:

<h3>about</h3>  <p>boston ember monthly meetup awesome people 

to awesome ember related things!

my about-page-test.js is:

import ember 'ember'; import startapp 'bostonember/tests/helpers/start-app';  var app;  module('integration - page', {   beforeeach: function() {     app = startapp();   },   aftereach: function() {     ember.run(app, 'destroy');   } });  test('should navigate page', function() {   visit('/').then(function(assert) {     click("a:contains('about')").then(function(assert) {       assert.equal(find('h3').text(), 'about');     });   }); }); 

the page functions should , command line not return errors:

file changed templates/application.hbs  build successful - 691ms. 

but when go http://localhost:4200/tests see bunch of errors...

integration - page: should navigate page (1, 0, 1)rerun210 ms typeerror: cannot read property 'equal' of undefined@ 190 ms expected:   true result:     false diff:   trufalse source:          @ http://localhost:4200/assets/test-support.js:4578:13     @ exports.default._embertestingadaptersadapter.default.extend.exception (http://localhost:4200/assets/vendor.js:52460:34)     @ onerrordefault (http://localhost:4200/assets/vendor.js:43162:24)     @ object.exports.default.trigger (http://localhost:4200/assets/vendor.js:67346:11)     @ promise._onerror (http://localhost:4200/assets/vendor.js:68312:22)     @ 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' not defined. integration/about-page-test.js: line 15, col 1, 'test' not defined. integration/about-page-test.js: line 16, col 28, 'assert' defined never used.  3 errors@ 0 ms expected:   true result:     false diff:   trufalse source:          @ object.<anonymous> (http://localhost:4200/assets/bostonember.js:337:12)     @ object.test.run (http://localhost:4200/assets/test-support.js:3566:28)     @ http://localhost:4200/assets/test-support.js:3695:11     @ process (http://localhost:4200/assets/test-support.js:3254:24)     @ begin (http://localhost:4200/assets/test-support.js:3299:2)     @ http://localhost:4200/assets/test-support.js:3315:4 

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

you need include qunit assertions , startapp ember testing helpers.

import ember "ember"; import { module, test } 'qunit'; import startapp '../helpers/start-app'; 

module can defined models.

import { test, moduleformodel } 'ember-qunit';   moduleformodel('recipe/recipe', 'unit | models | recipe |', {     needs: ['model:recipe/recipe', 'model:recipe/category', 'model:filerepository/file'] }); 

where

this.subject()

references imported module.

examples: http://www.ember-cli.com/user-guide/#testing


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -