Skip to main content

Questions tagged [squirejs]

Squire.js is a dependency injector for Require.js users to make mocking dependencies easy!

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
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
0 votes
1 answer
58 views

Squire Mock Model not working with lists

In my Squire spec, I am mocking the model my controller takes. The controller dynamically adds a list of objects to the model, but it's not there when the spec runs the expectation. It works when a ...
ichan's user avatar
  • 41
0 votes
1 answer
488 views

How can I mock RequireJs loader plugin responses in unit tests

The code I'm trying to test relies on RequireJs loader plugins. Example with requirejs/text: require(['text!templates/foo'], function (data) { // handle loaded data }); For a specific unit test, I'...
talkol's user avatar
  • 12.8k
2 votes
1 answer
1k views

How to mock inline requirejs dependencies with squire for unit testing?

I'm using requirejs with inline requires, for instance: define(['someDep'], function(someDep) { return { someFn: function() { require(['anotherDep'], function(anotherDep) { ...
Paul Spencer's user avatar
  • 1,385
1 vote
1 answer
1k views

Using RequireJS with Mocha and SquireJS on node

I am trying to use RequireJS in node, and found difficulties with path issues. Here is a simple foo method that returns "foo" $ cat src/foo.js define([], function() { var foo = function() { ...
itaifrenkel's user avatar
  • 1,598
1 vote
1 answer
2k views

How to run code before (or after) each test in karma

I'm looking to use squire.js with karma and want to do a squire.clean() to clean away all the mocks before the next test suite (I'm using jasmine) is run but I cannot see a way to configure karma to ...
Jack Allan's user avatar
  • 14.9k
3 votes
1 answer
2k views

Jasmine specs not being executed when injecting dependencies with Squire.js

I am attempting to run some Jasmine unit tests for a Backbone view, mocking out dependencies in Squire. The dependencies of my view are a Baseview, an ICanHaz template and an i18n translation. I ...
Simon Adcock's user avatar
  • 3,564
5 votes
1 answer
1k views

Squire.js not substituting fake dependency when using store

I'm trying out Squire.js as a dependency loader for RequireJS. Using a totally normal web browser for running unit tests. I want to use store to get a handle to my mocks. But can't stop Squire ...
sennett's user avatar
  • 8,294
20 votes
1 answer
5k views

Squire.js example with Jasmine and RequireJS

I want to write JS tests. The production code is written with RequireJS. I found a test lib named Squire.js: https://github.com/iammerrick/Squire.js/ From the Squire.js website Run generates a ...
Androidewbie's user avatar
8 votes
2 answers
1k views

Squire is breaking other tests

I'm using Karma, Jasmine, Jasmine.Async, Sinon and Chai. The good news...this test works correctly. The dependency is mocked, spies get called, and intentionally breaking the test subject results in ...
Dom Barker's user avatar
  • 1,918
4 votes
1 answer
965 views

Squirejs causing random tests to intermittently fail or not run at all

We're using Karma and Mocha along with Squire for mocking dependencies loaded with RequireJs. Without Squire, our tests run fine however as soon as we initialize a Squire object, everything start ...
ajbeaven's user avatar
  • 9,514