Can't use debugger in tests in 0.1.7


#1

How strange, I can’t use the debugger statement after upgrading from 0.1.5 to 0.1.7.

JSHint - console/tests/acceptance: console/tests/acceptance/user-can-login-test.js should pass js
hint
    ✘ console/tests/acceptance/user-can-login-test.js should pass jshint.
    console/tests/acceptance/user-can-login-test.js: line 22, col 3, Forgotten 'debugger' stateme
nt?
    console/tests/acceptance/user-can-login-test.js: line 22, col 11, Missing semicolon.

    2 errors

Test code:

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

var application;

var defaultLogin = {
  email: 'support@test.com',
  password: 'testing'
};

module('Acceptance: As a user I can login', {
  setup: function() {
    application = startApp();
  },
  teardown: function() {
    Ember.run(application, 'destroy');
  }
});

test('visiting /user-can-login', function() {
  visit('/login');
  debugger

  andThen(function() {
    equal(currentPath(), 'login');
    fillIn("#login_email", defaultLogin.email);
    fillIn("#login_password", defaultLogin.password);
    click("#login_submit");
    andThen(function() {
      equal(currentPath(), 'dashboard.index');
    });
  });
});

#2

The test that is failing is a JSHint test. It does not prevent your debugger from functioning properly.


#3

It use to pause the state in chrome, but it no longer does that.


#4

Just a thought, maybe you blackboxed the script in the debugger?


#5

@Leeft could you elaborate? What do you mean by blackboxing?


#6

Blackboxing (in Chrome anyway) excludes the script from throwing exceptions that are then trapped by the debugger, and makes the debugger skip that file during step by step tracing. Doesn’t work that well though with ember-cli since it’s all in a single .js in reality.


#7

So this may be an issue with jshint.

So in my .jshintrc file:

"debug": false,

I tried changing it to true but nothing changed.

Maybe ember test server is not picking up my .jshintrc file? It did before…


#8

Ah-hah! Chrome developer tools needs to be open in order for debugger to work.