Skip to main content

All Questions

Tagged with
0 votes
1 answer
236 views

Testing events with RequireJs + Karma + Jasmine

i'm trying to find a way to test events. Like in topic title my stack is RequireJs + Karma + Jasmine. I dont want to use jQuery or any not essential external libraries. There's icon-utils code i use ...
Marcin Rubach's user avatar
0 votes
0 answers
215 views

Squirejs : requirejs is not defined

We have an amd/requirejs based web app. We came to a point to add a unit testing to our code. Googling returned that squireJs is best amd-require based mocking library. after installing, The problem ...
ISkandar's user avatar
0 votes
1 answer
145 views

Chutzpah doesn't detect jasmine tests in Typescript with AMD modules

We are trying to figure out a approach for UI testing and felt chutzpah will be a nice option. I wrote jasmine tests using typescript and requirejs. Chutzpah is able to detect the sample tests which ...
Naresh_drake's user avatar
1 vote
0 answers
28 views

RequireJS data-main does not load from html files at different paths

Using RequireJS successfully for a single page application for quite some time. Finally adding JS unit tests to exercise model classes. I have a single config for src modules and another for test ...
jmelvin's user avatar
  • 647
0 votes
0 answers
25 views

Defining requirejs controllers in jasmine test giving undefined

I have a requires controller file which defines Backbone Models and Views into its structure and then with every different functionality of the model it invokes its corresponding Rest Web Service call....
Nephilim700's user avatar
0 votes
1 answer
1k views

"define is not defined" - jasmine-node requirejs in Nodejs

I am trying to run jasmine tests on files that are using requirejs. I have a require.config.js file which provides all the configuration for the requirejs and I am passing to this command to run the ...
Nephilim700's user avatar
1 vote
0 answers
404 views

Executing 0 of 0 Error on running unit test cases using Karma and Jasmine

I want to run the test cases using karma and jasmine. I have done the following, but it is giving error like: Error: Chrome 59.0.3071 (Linux 0.0.0): Executed 0 of 0 ERROR (0.12 secs / 0 secs) karma....
Sana's user avatar
  • 23
0 votes
1 answer
1k views

Uncaught Error: Mismatched anonymous define() module: function in karma and jasmine unit testing with requirejs [duplicate]

I am trying to run unit test cases for my controllers, I have tried the following but getting the below error, please let me know to run this test successfully. Thanks in advance. spec.js: describe('...
Sana's user avatar
  • 23
0 votes
1 answer
292 views

stView.el is undefined while testing Backbone view with jasmine

I'm using Jasmine for unit testing to test an application with Backbone.js (and it's the first time that I'm working with them both so I'm a little bit stuck :/ ) Here is my Backbone view ...
Mariama Mariama's user avatar
1 vote
0 answers
63 views

Karma is not seeing test files [duplicate]

I used to use my SpecRunner.html to run Jasmine tests but I'd like to change it for Karma testrunner. However, I have problems with configuration of Karma + requirejs. This is my working tree: This ...
Hubert Kubiak's user avatar
0 votes
1 answer
510 views

Testing TypeScript modules with Jasmine and ReSharper

I have the following Jasmine test in a TypeScript file in a VS2017 project: describe("A trivial test", () => { it("Should pass", () => { expect(true).toBeTruthy(); }); }); This runs ...
fractor's user avatar
  • 1,596
0 votes
0 answers
47 views

How to set the dependency of dynamically generated .js library through require in jasmine specs

Currently I am writing jasmine specs for already developed backbone.js application. I have to write jasmine specs for each module for unit testing. I have a module in which one of the .js (say abc.js) ...
user3878988's user avatar
1 vote
1 answer
726 views

How to use Jasmine to Spy on Modules being loaded by requireJS?

So I'm using Typescript/RequireJs/Jasmine, and can't get my spy to work for modules loaded in another module. Here is my Spec: import { CrmWebApiLib } from "../../../webresources/allgnt_/scripts/...
Daryl's user avatar
  • 18.8k
0 votes
1 answer
330 views

Replacing dependencies in AMD module format with testdouble.js

I'm writing tests for a JS application using Jasmine and testdouble.js as a mocking library. I am using AMD format to organize code in modules, and RequreJS as a module loader. I was wondering how to ...
vladamon's user avatar
  • 297
1 vote
1 answer
2k views

Global variable not being assigned in Jasmine unit test

I'm having some issues with a Jasmine unit-test seeing a global variable as undefined. I'm using Squire to mock some classes with the dependencies injected via RequireJS. Here is a trimmed down ...
dajaffe's user avatar
  • 855
-1 votes
1 answer
485 views

AVA Unit Test: Use gulp-ava to test global functions

I'm new on using AVA for JS unit tests and I immediately hit a rock: My situation is that I want to run a gulp task to run the AVA tests and watch the test files, and in the test file I wrote I need ...
J. Doe's user avatar
  • 1
0 votes
1 answer
338 views

Decouple Knockout dependencies in Jasmine unit tests

I am introducing javascript unit tests to my company's application. I've worked predominantly with AngularJS, but their framework of choice is Knockout. The code is relatively modular in design (...
cidthecoatrack's user avatar
0 votes
1 answer
658 views

how to add navigator.geolocation.getCurrentPosition in phantomjs+jasmine+requirejs env

I just phantomjs + jasmine + requirejs + saga to test JavaScript codes. I used the way to mock navigator.geolocation.getcurrentposition following 0 in Does phantomJS support geolocations? My ...
Sunny's user avatar
  • 1
1 vote
2 answers
2k views

Karma test run with Jasmine cannot find TypeScript module

I want to test my TypeScript code with Jasmine executed by Karma. Unfortunately the Karma is unable to find my module and exists with "Module name has not been loaded yet for context". My ...
Benny Code's user avatar
  • 53.8k
0 votes
1 answer
65 views

Jasmine & requirejs support for multi modules?

I am currently using Jasmine ("jasmine": "^2.4.1") with Node v6.1.0 I am both trying to provide and consume multiple modules in one file - however keep getting errors like object undefined or null ...
shenku's user avatar
  • 12.3k
3 votes
1 answer
318 views

Coverage.json not generated with Jasmine RequireJS and Istanbul in grunt

I have trying to generate coverage report based from grunt using grunt-template-jasmine-istanbul. The Specs are executed correctly but no coverage report is generated. Below is my code in the config ...
Arun Kumar's user avatar
0 votes
1 answer
79 views

Karma test run throwing error on requirejs

I have the below configuration in the karma config file. frameworks: [ 'jasmine', 'requirejs' ], files: [ //App Bower components {pattern: 'public/...
Priyabrat Nanda's user avatar
0 votes
0 answers
81 views

Running Jasmine tests from Node against code that uses RequireJS

Is it possible to run Jasmine from Node to test code that uses RequireJS? I am using the Jasmine NPM. I can run some tests from Node but can't work out how to test my code that uses RequireJS. V2 of ...
James's user avatar
  • 71
3 votes
2 answers
643 views

PhantomJS not playing nice with RequireJS+Jasmine

I have some tests running with RequireJS and Jasmine. I have a Jasmine test harness file that looks like this: <html> <head> <meta charset="utf-8" /> <link rel="...
user3715648's user avatar
  • 1,568
5 votes
1 answer
705 views

State of Jasmine Unit Test support of Resharper 2017: Debug mode and AMD modules supported?

I currently use Chutzpah to run and debug Jasmine Unit tests that include AMD/require.js modules. I would like switch to the test runner of Resharper 2017. However, Resharper does not seem to fully ...
Stefan's user avatar
  • 11.6k
0 votes
1 answer
101 views

Angular-Jasmine, loading json

I am trying to load json from local folder and then feed it into function to test it. Here is what I am trying to do: it('should be able to use treatExpResultJSON() function to treat incoming JSON', ...
Nikita Vlasenko's user avatar
0 votes
1 answer
64 views

How to make requirejs to work with jasmine and blanketjs for code coverage?

I was working on generating code coverage report using blanketjs. Click here . But I am finding difficulty in achieving the same. Here's my code : require(['jquery', 'boot', 'JasmineBlanket'], ...
graphics123's user avatar
  • 1,261
0 votes
1 answer
288 views

Knockout, requirejs and Jasmine test fails

I've got a knockout component with the following view model: define(["jquery", "knockout"], function ($, ko) { return function () { function companySet(value) { var self =...
cloggins's user avatar
  • 669
1 vote
0 answers
138 views

Istanbul coverage with built React JavaScript and Jasmine

I have a built version of a React module that I'm testing successfully with Jasmine but when I try to use Istanbul to determine my tests coverage it shows that I'm only testing the Require.js Define ...
sbason's user avatar
  • 11
0 votes
1 answer
826 views

Jasmine Testing knockout.js with requirejs

I am having trouble getting my Jasmine test file to get data from my knockoutjs files. I am able to create knockout observables and test those in the the spec file but not other files. For some reason ...
laskdjf's user avatar
  • 1,172
0 votes
2 answers
34 views

What does calling 'done' do in the context of asynchronous testing?

In Louis' answer, there is the following code: describe("ModuleName", function() { var mod; beforeAll(function (done) { // This loads your module and saves it in `mod`. ...
pixelpax's user avatar
  • 1,519
5 votes
1 answer
1k views

Karma/Jasmine tests fail with error: 'Uncaught Error: Module name "simple_test.js" has not been loaded yet for context: _. Use require([])'

I am using Karma and Jasmine to run tests on my project built with React. When I try to run my Karma tests I get this error in the console: Running "karma:test" (karma) task WARN `start` method is ...
CascadiaJS's user avatar
  • 2,488
0 votes
1 answer
38 views

Where is this object now?

I have to test some RequireJS JavaScript code and don't understand how to replace a special object. This is the code (simplified) of one function within a RequireJS Module: changeView: function (view)...
Garrarufa's user avatar
  • 1,205
8 votes
2 answers
468 views

require using AMD pattern gives error for jQuery UI events

In my code test.js is dependent on jquery-ui which does not uses require AMD pattern and test.spec.js dependent on jquery-ui, test.js which uses AMD pattern. Can we load dependency of jquery-ui in ...
Rahul Rajput's user avatar
  • 1,437
8 votes
2 answers
6k views

"Error: Mismatched anonymous define()" with Karma + RequireJS + Jasmine

I am stuck now for a while trying to get unit testing set up and runnning. I have an AngularJS front-end loaded with RequireJS and r.js optimized for production, so it's all nicely in one single file....
robbash's user avatar
  • 1,073
0 votes
1 answer
216 views

Can't figure out where to put require.config when using TypeScript, RequireJs, and Jasmine

I've been following the pattern for setting up TypeScript, RequireJS, and Jasmine that Steve Fenton describes here: https://www.stevefenton.co.uk/Content/Blog/Date/201407/Blog/Combining-TypeScript-...
Bernard Hymmen's user avatar
1 vote
1 answer
2k views

How to start jasmine tests with grunt?

I want to create a grunt task for running jasmine tests automatically when the code changed. For AMD support I installed grunt-template-jasmine-requirejs. I added these lines to my gruntfile: connect:...
Garrarufa's user avatar
  • 1,205
1 vote
0 answers
1k views

require.config TypeError: undefined is not a function

I want to write some tests with Jasmine. Therefore I first want to load RequireJS. Thus I put a reference in the Jasmine.json file: { "spec_dir": "spec", "spec_files": [ "**/*[sS]pec.js" ], ...
Garrarufa's user avatar
  • 1,205
0 votes
1 answer
128 views

Jasmine test case in maven with requirejs

I want to use jasmine for unit testing javascript application. My application uses requirejs. I found Jasmine maven plugin This plugin works great for non requirejs application. It also has requirejs ...
dmay's user avatar
  • 1,315
2 votes
1 answer
2k views

Javascript Jasmine Testing: Prevent tested function to call function from object that was created within tested function

I want to test a Javascript function with Jasmine that has a structure like this: showEditUser: function (...) { // more code here... var editUserView = new EditUserView(); // more code ...
Garrarufa's user avatar
  • 1,205
1 vote
1 answer
308 views

BlanketJS + Jasmine + RequireJS no code coverage

I am trying to get the same setup as this tutorial. First Off. My file structure is: /assests /css /font /img /js /collection /lib /model /plugin /spec -> Tests in ...
Filipe Teixeira's user avatar
1 vote
2 answers
45 views

How to use RequireJS properly?

I need to test a JavaScript project. There are described several modules but when I try to load them something goes wrong. define([ 'core/BaseModel' ], function (BaseModel) { var MessageModel = ...
Garrarufa's user avatar
  • 1,205
0 votes
0 answers
180 views

RequireJS error: Timeout

I am testing a JavaScript project with Jasmine. Everything went well but suddenly nothing works anymore although I cannot remember to have changed anything. I get this error: Error: Timeout - Async ...
Garrarufa's user avatar
  • 1,205
0 votes
1 answer
187 views

How can I load a module with RequireJS for testing in a testing framework like Jasmine?

I am new to JavaScript and try to test functions defined in a RequireJS Module. That means i have some code like this: define([...], function(...){ var ModuleName = Base.extend({ init: ...
Garrarufa's user avatar
  • 1,205
0 votes
1 answer
848 views

Writing Unit Testing With Jasmine , Require JS in Karma for Angular JS?

I have Done a Library Management App with Angular JS and Mongo Lab will Act as a DB Part, I am facing issuse with Require JS Dependency While Crating Unit test Case Error: [$injector:modulerr] Failed ...
Siva G's user avatar
  • 1,178
1 vote
1 answer
2k views

Backbone Views / Jasmine / Requirejs - Cannot read property replace of undefined

Using Jasmine, I have already written tests for my models and controllers and all have passed. However, I am running into a lot of problems if I test my views. IF I remove views/hf_appView from ...
snewc's user avatar
  • 45
0 votes
1 answer
482 views

angular js dynamically loading modules + requirejs

controller.js define([ 'angular', 'app', 'underscore', 'jquery' ], function (angular, app, _, $) { 'use strict'; var module = angular.module('kibana....
Biga Gaber's user avatar
0 votes
0 answers
72 views

How can I write a unit test for Loading AngularJS Components With RequireJS After Application Bootstrap?

I write a unit testing for angular js applications. the bootstrap for this app loading dynamically. when I write the unit test for this always error happen like didn't find the module or unknown ...
Ahmed Gaber - Biga's user avatar
1 vote
0 answers
80 views

Spy doesn't get called using async jasmine and requirejs

I have a setup of AngularJS application that uses RequireJS to download and register services on-demand. I also use Jasmine for testing. I am trying to test if a function is called in the callback of ...
user2080579's user avatar
0 votes
1 answer
1k views

RequireJS, Jasmine and Grunt Error: scripterror: Illegal path or script error

I have an application which uses requireJS, and I would like to use grunt-contrib-jasmie to test it. In order to get jasmine to work with require I am using cloudchen's grunt-template-jasmine-...
Dean Nasseri's user avatar

15 30 50 per page