2

I am using QUnit+Sinon.js which works well natively. The problem was occured when I tried to build it into a continous integration process. I am using js-test-driver framework to be able to run it in continous integration enviroment. In the past I used it without Sinon.js and it wasn't any problem with that. But after I included the Sinon.js plugin, it doesn't work at all. When I tried to run my tests it says:

D:/my/project/url/contentTest.js:60: TypeError: qTest is not a function
Total 0 tests (Passed: 0 Fails: 0 Errors: 0)(0.00 ms)

My js-test-driver configuration:

server: http://localhost:9879

load:  
  # QUnit related files
  - qunit/lib/equiv.js
  - qunit/lib/QUnitAdapter.js
  - qunit/plugin/sinon-1.6.0.js
  - qunit/plugin/sinon-qunit-1.0.0.js

  # Dependencies
  - external/jquery/1.7.2/jquery.min.js

  # Files under test
  - content.js

  # Tests
  - contentTest.js

The interesting thing is that there is a QUnit index.html file which works well (when I open this html, every tests passes):

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>my tests</title>
  <link rel="stylesheet" href="./qunit/lib/qunit-1.11.0.css">
</head>
<body>
  <div id="qunit"></div>
  <div id="qunit-fixture"></div>

  <!-- core -->
  <script src="./qunit/lib/qunit-1.11.0.js"></script>
  <script src="./qunit/plugin/sinon-1.6.0.js"></script>
  <script src="./qunit/plugin/sinon-qunit-1.0.0.js"></script>

  <!-- dependencies -->  
  <script src="./external/jquery/1.7.2/jquery.min.js"></script>

  <!-- under test  -->
  <script src="./content.js"></script>

  <!-- tests -->
  <script src="./contentTest.js"></script>
</body>
</html>

So it seems there is a conflict with js-test-driver and Sinon.js. If I remove all related Sinon.js tests and the included sinon plugins, then it works. If I just remove the sinon related tests, it still failes. If I don't remove sinon.js but remove all tests and create an emty test with an "ok(true)" assert, then it still fails with the same error message (contentTest.js:60: TypeError: qTest is not a function), however my test file is consists just 10 row (how it could be an error in 60.th line when my file consists only 10 line?).

Thank you all for any helps in advance!

Iamisti
  • 1,680
  • 15
  • 30

1 Answers1

0

Not a solution, but perhaps an approach to get more information: can you run the js-test-driver scripts locally from a shell? Does it produce similar error details? At the very least, this will give you more information and a shorter feedback loop.

robrich
  • 13,017
  • 7
  • 36
  • 63