question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Squire makes the test cases to run twice.

See original GitHub issue

I have started using Squire.js along with my karma-mocha setup.

The problem I’m facing is the test cases which does uses Squire, something like this:

new Squire();

Those test cases alone runs twice. I really don’t know whats the issue with this.

I have even tried turning off autowatch in karma config to off. But still the same issue.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
toonketelscommented, Oct 14, 2015

I ran into the same issue. It seems to be triggered by the callback: window.__karma__.start in require.config({}) for your tests.

Ensure that one is only run once. You could use _.once or something a bit more simplistic like:

window.IS_INITIAL_RUN = true;

require.config({

   callback: function() {                                                                                                                                                                                                                
       if (!window.IS_INITIAL_RUN) return;    

       window.IS_INITIAL_RUN = false;                                                                                                                                                                                                    
       window.__karma__.start()                                                                                                                                                                                                          
   }, 

  // more config...
});
1reaction
tstibbscommented, Aug 11, 2016

This issue also breaks qunit’s async stuff.

It would be useful to have toonketels’s snippet in the readme for squire so it was a bit more accessible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 2.7 - Test case running twice not once - Stack Overflow
This is happening because you're not telling nose that you want to only run the tests in TALogout_Test . It's running both TALogin.test...
Read more >
Issues · iammerrick/Squire.js · GitHub
Your friendly dependency injector for testing Require.js modules. - Issues · iammerrick/Squire.js. ... Squire makes the test cases to run twice.
Read more >
Reading 3: Testing
We want to pick a set of test cases that is small enough to be easy to write and maintain and quick to...
Read more >
Amazon.com: Gamegenic Squire 100+ Convertible Deck Box
Amazon.com: Gamegenic Squire 100+ Convertible Deck Box | Card Storage Box with Removable Cover | Holds 100 Double-Sleeved Cards | Premium Nexofyber Deck...
Read more >
A quick introduction to the Google C++ Testing Framework
Running the tests is simple. Just making a call to the predefined RUN_ALL_TESTS macro does the trick, as opposed to creating or deriving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found