Good afternoon Habr.
Yesterday version 1.1.0 was
released test.it - a framework for testing js code.
He finally got a functional, the absence of which made it inferior:
- Asynchronous tests / groups
- Run individual tests / groups
As well as other trifles.

Who doesn’t like a lot of words
? Website where you can see the code in action,
GitHub ,
Wiki Changjlog
- Changes under the hood
- serious refactoring - changing the technology of chaining and inheritance
- the ability to run in a windowless environment (in which there is no window object, for example, node.js)
This is a preparatory operation for the port under node.js, angular.js and the like.
- Interface changes
.done () received additional functionality as a method of completing the chain.
There are new methods and attributes:
- chain link .addTrace (level)
- circuit prep .time
- chain prepare .exclude
- Corrected:
- a lot of grammatical errors (thanks tenphi and asmgf )
- root time bug with multiple test.done () calls
- Updated wiki, site and sample
')
New opportunities
Link chain.
Addtrace (level) - adds to the test / group
trace - the list of lines that led to its execution.
level - sets the number of lines to be displayed
(or the depth of the scopes to which the trace will go) .
The method was added at the request of the user vk
Denya Tatarinov , with the explanation that this is useful for monitoring a large number of asynchronous calls (tests).
I have a good habit to log every ajax request. more accurate response from the server. and when some kind of crap happens, I would like to know in which line it happened) not to write that man, this is the 45th line in each call. + helps to navigate by code
For this task, the output of only one (current) line is enough, but who knows who will need to track down some confusing code.
Sample and screenshot(function firstFunction() { (function secondFunction() { (function lastFunction() { test.it(1).addTrace(0);

Chain
preparer .time - adds to the test output the time spent on its execution
(or the execution of the function, the result of which was passed to the test)Please note that this is not a method, but an attribute.
Do not put brackets after it!Sample and screenshot test.time.it(someThing());

.Exclude chain
preparer - prevents a test or group from falling on the current level stack. This attribute also
does not put brackets after it!May be useful for asynchronous tests.
Example alert(test.exclude.it(someThing).result());
Conclusion of individual tests and groups
Finally, all these .group made sense!.done () - depending on how and where the output was called:
- As a method of the test object outside the groups, it will display the result as before.
Example test.done();

- As a method of the test object within a group, it will display this group including all tests and subgroups that managed to get there.
Example test.group('group of tests',function(){ test.it(false); test.done(); test.it(true); });

- As the ending link in the chain of groups - will display the last group in the chain
Example test.group('group of tests',function(){ test.it(true); test.it(false); }).done();

- As the ending link in the chain of test - will bring this test
Example test.it(true).comment(' ').done();

Asynchronous tests
Thanks to the new
.done () behavior
(and a little .exclude ) , asynchronous tests are now available:
var a = false;
After ~ 3 seconds in the console will be:

Todo
now, in addition to polishing the already done, I set the priority task - a
port on node.js and similar languages (?).
Links
The site where you can see the code in action,
GitHub ,
WikiPS
While refactoring, I wondered who actually needs
test.them and
test.types ? In this connection, I want to ask the community a question, what tests do you use most often?
What tests do you need in principle?The survey will show tests only from this framework, but in the comments you can speak about tests in other frameworks, including for other languages.