jasmine-node
Advanced tools
Comparing version 1.0.26 to 1.0.27
@@ -44,3 +44,4 @@ var walkdir = require('walkdir'); | ||
if(!path.existsSync(file)) { | ||
var existsSync = fs.existsSync || path.existsSync; | ||
if(!existsSync(file)) { | ||
watcher.close(); | ||
@@ -47,0 +48,0 @@ return; |
@@ -81,3 +81,4 @@ var jasmine = require('./index'); | ||
if(!Path.existsSync(dir)) | ||
var existsSync = fs.existsSync || path.existsSync; | ||
if(!existsSync(dir)) | ||
throw new Error("Test root path '" + dir + "' doesn't exist!"); | ||
@@ -96,2 +97,5 @@ | ||
default: | ||
if (arg.match(/^--params=.*/)) { | ||
break; | ||
} | ||
if (arg.match(/^--/)) help(); | ||
@@ -145,11 +149,16 @@ if (arg.match(/^\/.*/)) { | ||
jasmine.executeSpecsInFolder(specFolder, | ||
onComplete, | ||
isVerbose, | ||
showColors, | ||
teamcity, | ||
useRequireJs, | ||
regExpSpec, | ||
junitreport); | ||
var options = { | ||
specFolder: specFolder, | ||
onComplete: onComplete, | ||
isVerbose: isVerbose, | ||
showColors: showColors, | ||
teamcity: teamcity, | ||
useRequireJs: useRequireJs, | ||
regExpSpec: regExpSpec, | ||
junitreport: junitreport | ||
} | ||
jasmine.executeSpecsInFolder(options); | ||
function help(){ | ||
@@ -156,0 +165,0 @@ util.print([ |
@@ -12,8 +12,11 @@ var fs = require('fs'); | ||
var filename = __dirname + '/jasmine-2.0.0.rc1.js'; | ||
global.window = { | ||
setTimeout: setTimeout, | ||
clearTimeout: clearTimeout, | ||
setInterval: setInterval, | ||
clearInterval: clearInterval | ||
}; | ||
var isWindowUndefined = typeof global.window === 'undefined'; | ||
if (isWindowUndefined) { | ||
global.window = { | ||
setTimeout: setTimeout, | ||
clearTimeout: clearTimeout, | ||
setInterval: setInterval, | ||
clearInterval: clearInterval | ||
}; | ||
} | ||
@@ -32,3 +35,5 @@ var src = fs.readFileSync(filename); | ||
delete global.window; | ||
if (isWindowUndefined) { | ||
delete global.window; | ||
} | ||
require("./async-callback"); | ||
@@ -66,14 +71,16 @@ require("jasmine-reporters"); | ||
jasmine.executeSpecsInFolder = function(folder, | ||
done, | ||
isVerbose, | ||
showColors, | ||
teamcity, | ||
useRequireJs, | ||
matcher, | ||
junitreport){ | ||
jasmine.executeSpecsInFolder = function(options){ | ||
var folder = options['specFolder']; | ||
var done = options['onComplete']; | ||
var isVerbose = options['isVerbose']; | ||
var showColors = options['showColors']; | ||
var teamcity = options['teamcity']; | ||
var useRequireJs = options['useRequireJs']; | ||
var matcher = options['regExpSpec']; | ||
var junitreport = options['junitreport']; | ||
var fileMatcher = matcher || new RegExp(".(js)$", "i"), | ||
colors = showColors || false, | ||
specs = require('./spec-collection'), | ||
jasmineEnv = jasmine.getEnv(); | ||
jasmineEnv = jasmine.currentEnv_ = new jasmine.Env(); | ||
@@ -83,3 +90,4 @@ specs.load(folder, fileMatcher); | ||
if(junitreport && junitreport.report) { | ||
if(!path.existsSync(junitreport.savePath)) { | ||
var existsSync = fs.existsSync || path.existsSync; | ||
if(!existsSync(junitreport.savePath)) { | ||
util.puts('creating junit xml report save path: ' + junitreport.savePath); | ||
@@ -117,2 +125,3 @@ fs.mkdirSync(junitreport.savePath, "0755"); | ||
var filename = specsList[i]; | ||
delete require.cache[filename.path()]; | ||
require(filename.path().replace(/\.\w+$/, "")); | ||
@@ -119,0 +128,0 @@ } |
@@ -162,3 +162,3 @@ (function() { | ||
var failure = { | ||
spec: spec.description, | ||
spec: spec.suite.getFullName() + " " + spec.description, | ||
message: failureItem.message, | ||
@@ -165,0 +165,0 @@ stackTrace: failureItem.trace.stack |
@@ -7,2 +7,3 @@ exports.executeJsRunner = function(specCollection, done, jasmineEnv) { | ||
fs = require('fs'), | ||
coffeescript = require('coffee-script'), | ||
template = fs.readFileSync(__dirname + '/requirejs-wrapper-template.js', 'utf8'), | ||
@@ -70,2 +71,5 @@ buildNewContext = function(spec){ | ||
if (s.filename().substr(-6).toLowerCase() == 'coffee') { | ||
script = coffeescript.compile(script); | ||
} | ||
for(var i = 0; i < (colonMatches && colonMatches.length) || 0; i++){ | ||
@@ -76,3 +80,4 @@ dir = dir.replace(colonMatches[i], '/' + colonMatches[i].substring(0,1)); | ||
wrappedScript = template.replace(/#REPLACE URL#/, buildRelativeDirName(dir)) | ||
.replace(/#REPLACE TEST SCRIPT#/, script); | ||
.replace(/#REPLACE TEST SCRIPT#/, script) | ||
.replace(/#REPLACE REQUIRE-CS PATH#/, __dirname + '/cs'); | ||
@@ -79,0 +84,0 @@ vm.runInNewContext(wrappedScript, buildNewContext(s), s.path()); |
@@ -32,3 +32,6 @@ var test = function(require, define, undefined) { #REPLACE TEST SCRIPT# | ||
baseUrl: baseUrl, | ||
nodeRequire: require | ||
nodeRequire: require, | ||
paths: { | ||
cs: '#REPLACE REQUIRE-CS PATH#' | ||
} | ||
}); | ||
@@ -35,0 +38,0 @@ |
var walkdir = require('walkdir'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var specs = []; | ||
var specs; | ||
@@ -18,2 +18,3 @@ var createSpecObj = function(path, root) { | ||
var wannaBeSpecs = walkdir.sync(loadpath) | ||
specs = []; | ||
@@ -24,3 +25,4 @@ for (var i = 0; i < wannaBeSpecs.length; i++) { | ||
if (fs.statSync(file).isFile()) { | ||
if (!/.*node_modules.*/.test(file) && matcher.test(path.basename(file))) { | ||
if (!/.*node_modules.*/.test(path.relative(loadpath, file)) & | ||
matcher.test(path.basename(file))) { | ||
specs.push(createSpecObj(file)); | ||
@@ -36,3 +38,8 @@ } | ||
exports.getSpecs = function() { | ||
// Sorts spec paths in ascending alphabetical order to be able to | ||
// run tests in a deterministic order. | ||
specs.sort(function(a, b) { | ||
return a.path().localeCompare(b.path()); | ||
}); | ||
return specs; | ||
}; |
{ | ||
"name" : "jasmine-node" | ||
, "version" : "1.0.26" | ||
, "version" : "1.0.27" | ||
, "description" : "DOM-less simple JavaScript BDD testing framework for Node" | ||
@@ -27,4 +27,5 @@ , "homepage" : [ "http://pivotal.github.com/jasmine" | ||
, "bin" : "bin/jasmine-node" | ||
, "preferGlobal" : true | ||
, "main" : "lib/jasmine-node" | ||
, "scripts" : { "test" : "node lib/jasmine-node/cli.js spec" } | ||
} |
@@ -24,3 +24,3 @@ jasmine-node | ||
jasmine-node | ||
jasmine-node spec/ | ||
@@ -27,0 +27,0 @@ If you aren't using npm, you should add `pwd`/lib to the $NODE_PATH |
@@ -86,3 +86,5 @@ var jasmineNode = require(__dirname + "/../lib/jasmine-node/reporter").jasmineNode; | ||
it('sets the startedAt field', function() { | ||
expect(this.reporter.startedAt instanceof Date).toBeTruthy(); | ||
// instanceof does not work cross-context (such as when run with requirejs) | ||
var ts = Object.prototype.toString; | ||
expect(ts.call(this.reporter.startedAt)).toBe(ts.call(new Date())); | ||
}); | ||
@@ -201,2 +203,5 @@ | ||
var spec = { | ||
suite: { | ||
getFullName: function() { return 'Suite name' } | ||
}, | ||
description: 'the spec', | ||
@@ -227,3 +232,3 @@ results: function() { | ||
var failure = failures[0]; | ||
expect(failure.spec).toEqual('the spec'); | ||
expect(failure.spec).toEqual('Suite name the spec'); | ||
expect(failure.message).toEqual('the message'); | ||
@@ -230,0 +235,0 @@ expect(failure.stackTrace).toEqual('the stack'); |
Sorry, the diff of this file is not supported yet
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
130235
37
3707
14