I have set up Angular 2 project and created few components. Now I'm trying to create unit test for the components using Karma and Jasmin.
When I create a simple unit test without importing any of the components I'm able to get the results of my unit test in the console and in the browser. But when I import a component and run the Karma test runner I'm getting error as
tsc && concurrently "tsc -w" "karma start karma.conf.js"
[1] 17 01 2017 13:00:42.527:WARN [karma]: No captured browser, open http://localhost:9876/
[1] 17 01 2017 13:00:42.580:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
[1] 17 01 2017 13:00:42.581:INFO [launcher]: Launching browser Chrome with unlimited concurrency
[1] 17 01 2017 13:00:42.591:INFO [launcher]: Starting browser Chrome
[1] 17 01 2017 13:00:44.640:INFO [Chrome 55.0.2883 (Windows 7 0.0.0)]: Connected on socket /#2qlhL6ZqwV4SO_x0AAAA with id 74184386
[1] Chrome 55.0.2883 (Windows 7 0.0.0) ERROR
[1] Uncaught ReferenceError: require is not defined
[1] at testing/components/title/title.component.spec.js:2
[1]
[1] Chrome 55.0.2883 (Windows 7 0.0.0) ERROR
[1] Uncaught ReferenceError: require is not defined
[1] at testing/components/title/title.component.spec.js:2
[1]
Chrome 55.0.2883 (Windows 7 0.0.0): Executed 0 of 0 SUCCESS (0 secs / 0 secs )1]
How can I fix this issue?