mirror of
https://github.com/gundb/panic-server.git
synced 2026-05-07 03:00:26 -04:00
Add UID to each test, save test name when available
Each test now has a unique ID to reference by. This will be useful for reporters and tracking of "done" events. Also, each test now saves the name it's been given.
This commit is contained in:
@@ -4,8 +4,16 @@
|
||||
// deeply merge objects
|
||||
var assign = require('object-assign-deep');
|
||||
var defaults = require('./defaults');
|
||||
var Gun = require('gun/gun');
|
||||
|
||||
/*
|
||||
This is the test configuration constructor.
|
||||
An instance is created each time a new
|
||||
`test()` is declared, and is later configured
|
||||
dynamically by "Context.js".
|
||||
*/
|
||||
function Response(obj) {
|
||||
this.testID = Gun.text.random();
|
||||
|
||||
// provide defaults
|
||||
assign(this, defaults);
|
||||
|
||||
@@ -14,7 +14,6 @@ function done() {
|
||||
}
|
||||
|
||||
function Test(name, cb, time) {
|
||||
var ctx;
|
||||
if (!(this instanceof Test)) {
|
||||
return new Test(name, cb);
|
||||
}
|
||||
@@ -22,7 +21,11 @@ function Test(name, cb, time) {
|
||||
cb = name;
|
||||
}
|
||||
|
||||
ctx = new Context(this);
|
||||
if (typeof name === 'string') {
|
||||
this.description = name;
|
||||
}
|
||||
|
||||
var ctx = new Context(this);
|
||||
stack.push(ctx);
|
||||
cb.call(ctx, ctx);
|
||||
bump(ctx, done);
|
||||
|
||||
Reference in New Issue
Block a user