storybook-addon-specifications
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -44,11 +44,35 @@ 'use strict'; | ||
var it = exports.it = function it(desc, func) { | ||
if (beforeEachFunc[currentStory]) beforeEachFunc[currentStory](); | ||
var storyName = currentStory; | ||
var pushGoodResult = function pushGoodResult() { | ||
results[storyName].goodResults.push(desc); | ||
}; | ||
var pushWrongResult = function pushWrongResult(e) { | ||
console.error(storyName + ' - ' + desc + ' : ' + e); | ||
results[storyName].wrongResults.push({ spec: desc, message: e.message }); | ||
}; | ||
var emitUpdate = function emitUpdate() { | ||
var channel = _addons2.default.getChannel(); | ||
channel.emit(_.EVENT_ID, { results: results[storyName] }); | ||
}; | ||
var done = function done(e) { | ||
if (e) pushWrongResult(e);else pushGoodResult(); | ||
emitUpdate(); | ||
}; | ||
if (beforeEachFunc[storyName]) beforeEachFunc[storyName](); | ||
try { | ||
func(); | ||
results[currentStory].goodResults.push(desc); | ||
if (func.length) func(done);else { | ||
func(); | ||
pushGoodResult(); | ||
} | ||
} catch (e) { | ||
console.error(currentStory + ' - ' + desc + ' : ' + e); | ||
results[currentStory].wrongResults.push({ spec: desc, message: e.message }); | ||
pushWrongResult(e); | ||
} | ||
if (afterEachFunc[currentStory]) afterEachFunc[currentStory](); | ||
if (afterEachFunc[storyName]) afterEachFunc[storyName](); | ||
}; | ||
@@ -55,0 +79,0 @@ |
{ | ||
"name": "storybook-addon-specifications", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Add tests to your react storybook stories", | ||
@@ -56,3 +56,3 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"@kadira/storybook-addons": "^1.3.0", | ||
"@storybook/addons": "^3.0.0", | ||
"react": "^0.14.7 || ^15.0.0", | ||
@@ -59,0 +59,0 @@ "react-dom": "^0.14.7 || ^15.0.0" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
369
953287