Socket
Socket
Sign inDemoInstall

it

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

it - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

test/test-interface.test.js

2

lib/interfaces/bdd.js

@@ -38,2 +38,3 @@ "use strict";

var it = test._addAction;
_(["description", "should", "describe", "timeout", "getAction", "beforeAll", "beforeEach",

@@ -49,2 +50,1 @@ "afterAll", "afterEach", "context", "get", "set", "skip", "ignoreErrors"]).forEach(function (key) {

}).as(module);

@@ -12,17 +12,4 @@ "use strict";

Promise = _.Promise,
Action = require("./action"),
actionNames = {},
duplicateActionErrors = [];
Action = require("./action");
_.bus.on("addAction", function (action) {
var fullName = action.get("fullName");
if (actionNames[fullName]) {
duplicateActionErrors.push({
error: new Error("Duplicate test name:" + fullName),
test: action
});
}
actionNames[fullName] = true;
});
EventEmitter.extend({

@@ -53,5 +40,8 @@ instance: {

merge(this, options);
if (!this.sub && !this.filtered) {
this._static.tests[description] = this;
this._static.trackName(this);
}
_.bindAll(this, ["_addAction", "ignoreErrors", "_failSiblings", "_addTest", "timeout", "getAction", "beforeAll", "beforeEach", "afterAll", "afterEach", "context", "get", "set", "skip"]);

@@ -123,4 +113,5 @@ },

_addTest: function (description, cb) {
var cloned = this._static.clone(this, description, {sub: true, level: this.level + 1, parent: this}, cb);
var it = cloned._addAction;
var cloned = this._static.clone(this, description, {sub: true, level: this.level + 1, parent: this}, cb),
it = cloned._addAction;
_(["suite", "test", "should", "describe", "timeout", "ignoreErrors", "getAction", "beforeAll", "beforeEach",

@@ -142,8 +133,9 @@ "afterAll", "afterEach", "context", "get", "set", "skip"]).forEach(function (key) {

var action = new this.Action(description, this, this.level + 1, cb, status);
_.bus.emit("addAction", action);
this._static.trackName(action);
this.__shoulds.push(action);
return this;
},
__runAction: function (action) {

@@ -337,2 +329,25 @@ var stopOnError = this.stopOnError;

testNames: {},
duplicateTestErrors: [],
trackName: function(action){
var fullName = action.get("fullName");
if (this.testNames[fullName]) {
this.duplicateTestErrors.push({
error: new Error("Duplicate describe block or test name:" + fullName),
test: action
});
}
this.testNames[fullName] = true;
},
checkDuplicateNames: function(){
if (this.duplicateTestErrors.length > 0) {
_.bus.emit("printDuplicateActions", this.duplicateTestErrors);
return true;
}
},
clone: function (behavior, description, options, cb) {

@@ -369,3 +384,5 @@ return new this(description, merge({

run: function run(filter) {
var summaries = {}, tests = this.tests;
var summaries = {},
tests = this.tests;
filter = splitFilter(filter);

@@ -375,8 +392,10 @@ if (filter.length) {

}
if (!isEmpty(tests)) {
if (duplicateActionErrors.length > 0) {
_.bus.emit("printDuplicateActions", duplicateActionErrors);
throw new Error("" + duplicateActionErrors.length + " duplicate test name(s)");
if(this.checkDuplicateNames()){
throw new Error("Found " + this.duplicateTestErrors.length + " duplicate describe block and/or test name. Please use unique descriptions.");
}
_.bus.emit("start", {tests: tests, numActions: _(tests).values().invoke("get", "length").sum().value()});
return _.serial(_(tests).keys().map(function (k) {

@@ -424,2 +443,2 @@ return function () {

}
}).as(module);
}).as(module);
{
"name": "it",
"description": "A testing framework for node",
"version": "1.0.1",
"version": "1.1.0",
"keywords": [

@@ -49,3 +49,3 @@ "testing",

"grunt-browserify": "~0.2.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-uglify": "~0.11.0",
"grunt-contrib-jshint": "~0.3.0",

@@ -52,0 +52,0 @@ "colors": "1.1.2",

@@ -6,3 +6,2 @@ "use strict";

it.describe("it bdd",function (it) {

@@ -802,2 +801,2 @@

}).as(module);
}).as(module);

@@ -714,2 +714,1 @@ "use strict";

}).as(module);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc