Phantom and Chrome giving different results


#1

I have a project that I’m testing with Mirage to mock data. The problem is that my tests are failing in Phantom due to a malformed object being returned from normalizeResponse():

not ok 2 PhantomJS 1.9 - Acceptance: Sidebar can navigate to /rules
    ---
        message: >
            Error: Assertion Failed: normalizeResponse must return a valid JSON API document:
            	* One or more of the following keys must be present: "data", "errors", "meta". (http://localhost:7357/assets/vendor.js:15341)
        Log: |
            tracking Rules
    ...
not ok 3 PhantomJS 1.9 - Acceptance: Sidebar can navigate to /alerts
    ---
        message: >
            Error: Assertion Failed: normalizeResponse must return a valid JSON API document:
            	* One or more of the following keys must be present: "data", "errors", "meta". (http://localhost:7357/assets/vendor.js:15341)
        Log: |
            tracking Alerts
    ...
ok 4 PhantomJS 1.9 - Acceptance: Sidebar can navigate to /schedules
    ---
        Log: |
            tracking Scheduling
    ...
ok 5 PhantomJS 1.9 - Acceptance: Sidebar can navigate to /ad-tests
    ---
        Log: |
            tracking Ad Testing
    ...
ok 6 PhantomJS 1.9 - Acceptance: Sidebar can navigate to /flights
    ---
        Log: |
            tracking Flighting
    ...
ok 7 PhantomJS 1.9 - Acceptance: Sidebar can navigate to /actions
    ---
        Log: |
            tracking Bulk Actions

So, I’ve hooked into normalizeResponse() to investigate:

normalizeResponse: ->
  response = @_super(arguments...)

  for key, value of response
    console.log key + ": " + value

  return response

And, I’ve looked at the console output in Phantom:

tracking Rules
tracking Alerts
tracking Scheduling
tracking Ad Testing
tracking Flighting
tracking Bulk Actions
tracking foo

Then, I look at it in Chrome:

tracking Rules
data: 
tracking Alerts
data: 
tracking Scheduling
tracking Ad Testing
tracking Flighting
tracking Bulk Actions
tracking foo

So, response.data is defined in Chrome but is not designed in Phantom. What’s going on?

Thanks for any help. This one has got me stumped.