How to resolve a “define is not defined” error when using jasmine karma with compiled typescript to test a component?

How to resolve a “define is not defined” error when using jasmine karma with compiled typescript to test a component?


I have a typescript app that has been compiled down to a single file, myjs.js in the js folder. And I have karma jasmine setup on my workspace.

in the myjs.js there is the code

var require, define, requirejs;
(function() {compiled typescript code here } )();
etc etc etc;

Somewhere inside my compiled typescript is the code

define('component/to/test', ["dependencies"], function(dependencies){ ... }
in my jasmine testscript, I have,

Define ([component/to/test], function(component){ jasmine specifications here} );
However, when running the jasmine file with karma start, I get the error that

Define is not defined
I checked the karma config file, both files are included as js/.js and spec/.js .


Any idea what I am doing wrong, this is the first time doing something like this. If anyone know how to do this please tell me 










Other Asp.net related post:

Comments

  1. It was really a nice post and i was really impressed by reading this AngularJS4 Online Course

    ReplyDelete
  2. This blog is sharing lot of information. Software testing services are the important one for software development companies. Keep sharing more post like this.

    ReplyDelete

Post a Comment

Popular posts from this blog