literate-jasmine
Advanced tools
Comparing version 0.0.19 to 0.0.20
{ | ||
"name": "literate-jasmine", | ||
"description": "write jasmine tests in markdown", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"bin": { | ||
@@ -9,4 +9,7 @@ "literate-jasmine": "./bin/literate-jasmine" | ||
"dependencies": { | ||
"colors": "0.6.2", | ||
"jasmine-node": "1.13.1", | ||
"markdown": "0.5.0" | ||
"lodash": "2.4.1", | ||
"markdown": "0.5.0", | ||
"stack-trace-parser": "0.0.6" | ||
}, | ||
@@ -17,3 +20,4 @@ "engines": { | ||
"devDependencies": { | ||
"jasmine-node": "1.13.1" | ||
"jasmine-node": "1.13.1", | ||
"sinon": "1.8.2" | ||
}, | ||
@@ -29,4 +33,5 @@ "licenses": [{ | ||
"scripts": { | ||
"test": "jasmine-node --forceexit spec && ./bin/literate-jasmine README.md" | ||
"test": "jasmine-node --forceexit spec && ./bin/literate-jasmine README.md", | ||
"integration": "node spec/integration.js" | ||
} | ||
} |
var parser = require('../src/parser'), | ||
fs = require('fs'), | ||
markdown = require('markdown').markdown; | ||
@@ -3,0 +4,0 @@ |
require('jasmine-node'); | ||
var markdown = require('markdown').markdown, | ||
var colors = require('colors'), | ||
markdown = require('markdown').markdown, | ||
stackTraceParser = require('stack-trace-parser'), | ||
ROOT_LEVEL = 1, | ||
@@ -26,2 +28,19 @@ DESCRIBE_LEVEL = 2, | ||
parser = { | ||
displayEvalException: function(exception, name, code) { | ||
var parsedStackTrace = stackTraceParser.parse(exception); | ||
if (parsedStackTrace[0].isEval) { | ||
console.log('\n'); | ||
console.log(exception.toString().red, 'thrown from', name.red + ':'); | ||
console.log('. . . . .'); | ||
var errorOnLineNumber = parsedStackTrace[0].evalLineNumber - 2; | ||
code.split('\n').forEach(function(line, index) { | ||
if (index == errorOnLineNumber) { | ||
line = line.red; | ||
} | ||
console.log(line); | ||
}); | ||
console.log('. . . . .\n'); | ||
} | ||
}, | ||
parse: function(text) { | ||
@@ -104,3 +123,11 @@ var tree = markdown.parse(text), | ||
it.fn = new Function(it.code); | ||
it.fn = function() { | ||
try { | ||
return new Function(it.code)(); | ||
} | ||
catch (exception) { | ||
parser.displayEvalException(exception, it.name, it.code); | ||
throw exception; | ||
} | ||
} | ||
@@ -107,0 +134,0 @@ return it; |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
93021
11
327
5
2
1
+ Addedcolors@0.6.2
+ Addedlodash@2.4.1
+ Addedstack-trace-parser@0.0.6
+ Addedcolors@0.6.2(transitive)
+ Addedlodash@2.4.1(transitive)
+ Addedstack-trace-parser@0.0.6(transitive)