Permalink
Commits on May 17, 2012
  1. Fix a bug with Hiro running all suites even though we want just one

    Yesterday I made a change that showed only the suite we wanted if
    you specify its name in a querystring. But I forgot to update Hiro
    itself to ignore all other suites so, as the result, today you
    would *see* just one suite while Hiro would *run* all suites behind
    the scenes. This patch fixes that.
    committed May 17, 2012
  2. Add ability to run only one suite

    When working on a feature it is often nice to be able to run one
    particular suite. This patch modifies webui so that it reacts to
    a suite name being a part of a query string:
    
      http://localhost:7777/ <-- runs all tests
      http://localhost:7777/BasicTests <-- runs only BasicTests
    
    There's no UI for this yet because I'm not sure what's the best
    solution.
    
    Even though the solution is partial it closes GH-23.
    committed May 17, 2012
  3. Show failure location when possible

    Hiro 1 used to show location info whenever possible and, not to cause
    a regression, I backported it into Hiro 2. The code is slightly
    different, though: I got the latest version from QUnit's source code.
    
    This closes GH-22.
    committed May 17, 2012
Commits on May 16, 2012
  1. More helpful message for timedout tests.

    Message like "Expected: ''. Actual: ''" is not very helpful.
    Instead, we need to clearly describe that timeout limit has been
    exceeded, etc.
    committed May 16, 2012
  2. Add a way to specify custom timeout when pausing a test

    Sometimes you need more than the default timeout (250ms) to do
    your stuff. This patch adds a new argument to the Test.pause
    method that can be used to specify a custom timeout value.
    
      test.pause(500); // If after 500ms. test is still in paused
    	                 // state--consider it a failure.
    committed May 16, 2012
Commits on May 14, 2012
  1. New README

    Since we're merging Hiro 2 to master we need a new README that
    reflects coding style changes and so on.
    
    I've also renamed file to plain README because Markdown doesn't
    seem to understand new lines and long lines are not very readable
    in plain text.
    committed May 14, 2012
  2. Pass Test instance as the first argument instead

    So the change I made in 0931dd3
    was a mistake. Dynamically mixing in Suite and Test creates a
    clusterfuck in async tests.
    
    Instead I decided to introduce a backwards incompatible change and
    pass Test instance as the first argument of test case function.
    Value of 'this' in test case functions should refer to Suite
    instances only.
    committed May 14, 2012
  3. Make suite running synchronous

    Although async execution of suites looks pretty it introduces lots
    of problems with sandbox conflicts. Also, progress bar looks like
    it came straight from Windows Me.
    
    Since I am lazy and don't want to hunt down each case of async bugs
    I just changed the whole thing to be synchronous.
    committed May 14, 2012
  4. Add Sandbox.cleanup

    Since we don't want dozens of iframes flooding the DOM Sandbox needs
    a method to delete its container.
    committed May 14, 2012
  5. Remove colons from onStart and Test case messages

    Colons should be handled in the UI, not in the library.
    committed May 14, 2012
  6. Add Suite.getFixture method

    Suite.getFixture is used to get contents of a fixture without
    creating and appending an iframe to the DOM. Since we're not
    creating any iframes getFixture works only with data sandboxes.
    committed May 14, 2012
  7. Change in-test context to a mixin of Test and Suite

    Apparently, you need to have methods from both Test and Suite
    instances inside of your test cases. Due to backwards compatibility
    it has to be bound to 'this', we can't just introduce a new object
    or argument.
    
    That's why we have to mixing Test and Suite objects together
    when test case is executed as a part of a suite (as opposed to
    manually creating and running a single Test instance).
    committed May 14, 2012
  8. Fix backwards incompatible changes to the Sandbox.

    It seems like we forgot that a) we need references to window and
    document objects for URLed sandboxes b) older version of Hiro
    used to expose Suite.window and Suite.document.
    
    Since (a) is a sloppy mistake and (b) breaks current Hiro setups,
    we have to fix that.
    committed May 14, 2012
  9. Don't display empty suites in webui

    Displaying empty (no test methods) suites in webui doesn't serve
    any purpose. Empty suites are quite useful, on the other hand,
    when you want to mixin setup functions into other non-empty suites.
    
    So the easiest solution here is to fix webui to ignore empty suites.
    committed May 14, 2012
  10. Don't show fixture textareas

    We really don't need to see tons of textareas with fixtures in
    them so it's better to hide those elements. No need to explicitly
    hide <script> elements because they are not visible anyway.
    committed May 14, 2012
  11. Bind onTest to an instance of Test

    Since onTest is being called before each test people use it to not
    only generate test arguments but to add additional properties to
    the test case and so on. This patch makes the code below possible:
    
      hiro.module("MySuite", {
    		onTest: function () {
    			this.doctor =  "who";
    		},
    
    		testSomething: function () {
    			myFunc(this.doctor); // Will pass "who"
    		}
    	});
    
    However, to think about it, we just need to add an ability to
    have custom properties and methods in the suite declaration but
    that's an after-release task.
    committed May 14, 2012
Commits on May 13, 2012
  1. Add support for PhantomJS

    It's nice to be able to run Hiro tests with PhantomJS. This patch
    ports PhantomJS integration from Hiro 1 to Hiro 2 (notice changes
    in hiro listeners, etc.)
    
    To run existing Hiro tests do the following:
    
     1. Install PhantomJS
     2. Start serving files by running 'grunt run'
     3. In another terminal run 'phantomjs bin/phantom.js'
    
    This patch closes GH-18.
    committed May 13, 2012
  2. Disable run-all button when tests are running.

    It's a good practice to visually disable buttons that cannot or
    should not be pressed. Run-all button shouldn't be pressed when
    tests are already running so we need to disable it.
    committed May 13, 2012
  3. Fail the test when onTest raises an exception

    It's _extremely_ annoying to spend time debugging frozen tests only
    to realize that the source of the problem is in the onTest method.
    
    We need to fail tests if, for whatever reason, onTest raises an
    exception.
    committed May 13, 2012
  4. Add support for this.expect in tests.

    Almost all non-trivial JavaScript programs use callbacks heavily.
    This means that sometimes you want to make sure that all your
    assertions executed, even those inside the callback functions.
    
    this.expect allows developers to explicitly specify how many
    assertions need to be executed for the code to pass.
    
    This patch closes GH-16 and GH-11.
    committed May 13, 2012
Commits on May 12, 2012
  1. Show report for failed tests

    Having no information about your failed tests is quite annoying so
    I made webui to populate a hidden element with report data and then
    show it to the user. Schematically it looks like this:
    
      *BasicTests*
    
      testSimpleAssertions    PASS
    	testExceptions          PASS
      testAsync               PASS
    
      *NovelTests*
    
      testTitle               PASS
      testAuthor              PASS
      testFailedTest          FAIL
    
        Assertion: assertTrue
        Expected:  true
        Actual:    true
    
    In future, we should probably make Phantom output to resemble
    webui output.
    committed May 12, 2012
  2. Fix a bug with progress bar going to 200%

    We bind test.onComplete listeners for all suites which means that
    we need a way to detect when a listener is called for a test that
    is outside of the current suite. The best way to do this is to
    check whether the test element exists.
    committed May 12, 2012
Commits on May 11, 2012
  1. [webui] ability to run tests

    committed May 11, 2012
Commits on Apr 29, 2012
  1. Extra semantic assertsions.

    Extracted from patch GH-12 by @marijn.
    marijn committed with Apr 29, 2012
Commits on Apr 28, 2012
  1. Static version of WebUI

    committed Apr 28, 2012
  2. No need to expose hiro object

    committed Apr 28, 2012
Commits on Apr 27, 2012
  1. Integration test for hiro.run()

    committed Apr 27, 2012
  2. Add support for onTest

    committed Apr 27, 2012
  3. Add support for setUp

    committed Apr 27, 2012
  4. Add support for mixins

    committed Apr 27, 2012
  5. Add default grunt task

    committed Apr 27, 2012