Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added angular2-materialize directives breaks tests when using angular-cli and RC4 #70

Closed
JSkimming opened this issue Jul 29, 2016 · 2 comments

Comments

@JSkimming
Copy link

JSkimming commented Jul 29, 2016

We're developing a new angular 2 app and using the default template as created by the angular-cli.

In tracking down an inexplicable test failure, I believe I have identified it as the inclusion of angular2-materialize.

Rather than go into a long winded description, I've created a test repo to demonstrate the issue.

Go and see PR JSkimming/angular-materialize-test#1, I've linked it to travis to see the build failures.

The initial commit of the PR where I add angular2-materialize builds fine.

I then add the angular2-materialize directive in the second commit.

  directives: [
    MaterializeDirective
  ],

Which breaks the build with the following error:

Missing error handler on `socket`.
TypeError: (msg || "").replace is not a function
    at /Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/lib/reporter.js:45:23
    at onBrowserError (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/lib/reporters/base.js:58:60)
    at null.<anonymous> (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:87:13)
    at emit (events.js:172:7)
    at onKarmaError (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/lib/browser.js:95:13)
    at Socket.<anonymous> (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/lib/events.js:13:22)
    at emitOne (events.js:82:20)
    at Socket.emit (events.js:169:7)
    at Socket.onevent (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/lib/socket.js:335:8)
    at Socket.onpacket (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/lib/socket.js:295:12)
    at Client.ondecoded (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/lib/client.js:193:14)
    at Decoder.Emitter.emit (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/node_modules/socket.io-parser/node_modules/component-emitter/index.js:134:20)
    at Decoder.add (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/node_modules/socket.io-parser/index.js:247:12)
    at Client.ondata (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/lib/client.js:175:18)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Socket.onPacket (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/node_modules/engine.io/lib/socket.js:101:14)
    at emitOne (events.js:77:13)
    at WebSocket.emit (events.js:169:7)
    at WebSocket.Transport.onPacket (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/node_modules/engine.io/lib/transport.js:104:8)
    at WebSocket.Transport.onData (/Users/travis/build/JSkimming/angular-materialize-test/node_modules/karma/node_modules/socket.io/node_modules/engine.io/lib/transport.js:115:8)

Since we're using RC4, and I can angular2-materialize is on RC1 I wonder if there is an incompatibility issue. I can see #57 where there was discussion of upgrading, maybe that would help?

@JSkimming
Copy link
Author

Digging further the exception is caused because the karma reporter assumes the message is either a string or null, see issue karma-runner/karma#1969.

I applied a local fix to reporter.js along these lines:

if (msg && typeof(msg) !== 'string') {
  msg = JSON.stringify(msg);
}   

The resultant output of the test didn't provide much help though.

Chrome 51.0.2704 (Windows 10 0.0.0) ERROR
  {"originalErr":{}}

@rubyboy
Copy link
Contributor

rubyboy commented Aug 23, 2016

The library has been upgraded to RC5. Please check again and close if there's no issue anymore. Thanks.
Notice that the new version (5.0.0) has a breaking change of removing the dependency on materialize-css. This library will need to be imported separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants