Skip to content

ng test - TypeError: (msg || "").replace is not a function #699

@alvipeo

Description

@alvipeo

When you generate new project with 'ng new' and immediately run tests - they work. But when going a bit further and adding some dependencies (like jQuery, Bootstrap 4 and Trumbowyg) tests starts to fail right away with TypeError: (msg || "").replace is not a function. Here's the output:

10 05 2016 04:19:17.581:WARN [karma]: No captured browser, open http://localhost:9876/
10 05 2016 04:19:17.595:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
10 05 2016 04:19:17.600:INFO [launcher]: Starting browser Chrome
10 05 2016 04:19:18.359:INFO [Chrome 50.0.2661 (Windows 10 0.0.0)]: Connected on socket /#-kPxpXeuzKFiXoPcAAAA with id 7707656
Missing error handler on `socket`.
TypeError: (msg || "").replace is not a function
    at D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\lib\reporter.js:45:23
    at onBrowserError (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\lib\reporters\base.js:58:60)
    at null.<anonymous> (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\lib\events.js:13:22)
    at emitTwo (events.js:100:13)
    at emit (events.js:185:7)
    at onKarmaError (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\lib\browser.js:95:13)
    at Socket.<anonymous> (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\lib\events.js:13:22)
    at emitOne (events.js:95:20)
    at Socket.emit (events.js:182:7)
    at Socket.onevent (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\lib\socket.js:335:8)
    at Socket.onpacket (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\lib\socket.js:295:12)
    at Client.ondecoded (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\lib\client.js:193:14)
    at Decoder.Emitter.emit (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\node_modules\socket.io-parser\node_modules\component-emitter\index.js:134:20)
    at Decoder.add (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\node_modules\socket.io-parser\index.js:247:12)
    at Client.ondata (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\lib\client.js:175:18)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at Socket.onPacket (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\node_modules\engine.io\lib\socket.js:101:14)
    at emitOne (events.js:90:13)
    at WebSocket.emit (events.js:182:7)
    at WebSocket.Transport.onPacket (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\node_modules\engine.io\lib\transport.js:104:8)
    at WebSocket.Transport.onData (D:\Documents\Visual Studio 2015\Projects\TestAppCLI\node_modules\karma\node_modules\socket.io\node_modules\engine.io\lib\transport.js:115:8)
10 05 2016 04:19:21.367:WARN [Chrome 50.0.2661 (Windows 10 0.0.0)]: Disconnected (1 times)

Does anyone know how to fix it? It's really annoying. I already tried to recreate project from scratch, step-by-step => no luck :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentneeds: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions