3

Using the instructions here, I'm trying to configure QUnit tests through chutzpah

error

The error is:

Error: Error: Error: Called start() outside of a test context while already started
at start in https://cdnjs.cloudflare.com/ajax/libs/qunit/1.18.0/qunit.min.js (line 11)
at startQUnit (line 12)
at onPageLoaded (line 16)

And the test is formatted like:

module('Product - Somme Condition', {
    setup: function () {
        $('#Markup').append('<div>...</div>');
    },
    teardown: function () {
        $('#Markup').empty();
    }
});

test('Given When Then', function () {
  //..
});

With the HTML runner being set up like:

<!DOCTYPE html>
<html>
<head>
    <title>Product Test Runner</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/qunit/1.18.0/qunit.min.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/qunit/1.18.0/qunit.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/blanket.js/1.1.4/blanket.min.js"></script>
    <script src="../../BuildFiles/someDependency.js"></script>
    <script src="../../BuildFiles/product.js"></script>
    <script src="../Tests/Product/ProductTest.js"></script>
</head>
<body>
    <form>
        <div id="qunit"></div>
        <div id="qunit-fixture"></div>
        <div id="Markup"></div>
    </form>
</body>
</html>

The step is set up as a Visual Studio Test step:

test step
(I will change it to *.html once working, it's just easier to test on one, all files behave the same and are structured as above)

The tests show up in the log as "Passed", but the build step is inconclusive. How can I make this green?

build steps

-- EDIT

Using the example QUnit test,

Namely,

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>QUnit Example</title>
  <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.2.1.css">
</head>
<body>
  <div id="qunit"></div>
  <div id="qunit-fixture"></div>
  <script src="https://code.jquery.com/qunit/qunit-2.2.1.js"></script>
  <script src="tests.js"></script>
</body>
</html>

And calling chutzpah via:

chutzpah.console.exe C:\Dev_Scratch\testRunner.html

The error output is:

Chutzpah console test runner (64-bit .NET 4.0.30319.42000) Version 4.3.4.0 Copyright (C) 2016 Matthew Manela (http://matthewmanela.com).

Error: Error: Called start() while test already started running at start in https://code.jquery.com/qunit/qunit-2.2.1.js (line 2550) at startQUnit (line 12) at onPageLoaded (line 16) (line 18) While Running:C:\Dev_Scratch\testRunner.html

Error: Error: Called start() while test already started running While Running:C:\Dev_Scratch\testRunner.html

File: C:\Dev_Scratch\testRunner.html 1 total, 0 failed, took 0.01 seconds

Tests complete: 1 === 1 total, 0 failed, took 2.52 seconds ===

NikolaiDante
  • 18,469
  • 14
  • 77
  • 117

1 Answers1

0

There is no built in option in the build definition which could change the status.

Yellow with a ✓ stands for partially pass.

If you want to change the status of build to green. As a workaround, you could use a batch file to run your test. Then you just need to Redirecting Error Messages from Command Prompt: STDERR/STDOUT. This will do the trick.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thanks for the response, that sounds like a reasonable alternative... but I'd rather configure the QUnit tests or chutzpah to not throw the error in the first place :-) – NikolaiDante Jan 26 '17 at 09:56