jasmine-node
Advanced tools
Comparing version 1.0.23 to 1.0.24
@@ -143,8 +143,2 @@ var jasmine = require('./index'); | ||
helperCollection.load(specFolder, regExpSpec); | ||
if(helperCollection.getSpecs().length === 0) { | ||
match = ""; | ||
} | ||
jasmine.executeSpecsInFolder(specFolder, | ||
@@ -151,0 +145,0 @@ onComplete, |
@@ -8,4 +8,4 @@ exports.executeJsRunner = function(specCollection, done, jasmineEnv) { | ||
template = fs.readFileSync(__dirname + '/requirejs-wrapper-template.js', 'utf8'), | ||
buildNewContext = function(){ | ||
return { | ||
buildNewContext = function(spec){ | ||
var context = { | ||
describe: describe, | ||
@@ -15,2 +15,6 @@ it: it, | ||
xit: xit, | ||
beforeEach: beforeEach, | ||
spyOn: spyOn, | ||
waitsFor: waitsFor, | ||
runs: runs, | ||
jasmine: jasmine, | ||
@@ -22,11 +26,17 @@ expect: expect, | ||
module: module, | ||
specLoader: specLoader | ||
specLoader: specLoader, | ||
__dirname: spec.directory(), | ||
__filename: spec.path() | ||
}; | ||
context.global = context; | ||
return context; | ||
}, | ||
buildRelativeDirName = function(dir){ | ||
var retVal = "", | ||
thisDir = process.cwd();//.replace(/.:/, '\\c').split('\\'), | ||
thisDir = process.cwd(), | ||
toDir = dir.split('/'), | ||
index = 0, | ||
colonMatches = __dirname.match(/.:/); | ||
colonMatches = __dirname.match(/^.:/); | ||
@@ -37,7 +47,7 @@ for(var i = 0; i < (colonMatches && colonMatches.length) || 0; i++){ | ||
thisDir = thisDir.split('\\'); | ||
thisDir = thisDir.replace(/\\/g, '/').split('/'); | ||
for(; index < thisDir.length || index < toDir.length; index++) { | ||
if(thisDir[index] != toDir[index]){ | ||
for(var i = index; i < thisDir.length; i++){ | ||
for(var i = index; i < thisDir.length-1; i++){ | ||
retVal += '../'; | ||
@@ -70,3 +80,3 @@ } | ||
vm.runInNewContext(wrappedScript, buildNewContext(), s.path()); | ||
vm.runInNewContext(wrappedScript, buildNewContext(s), s.path()); | ||
}); | ||
@@ -73,0 +83,0 @@ |
@@ -7,27 +7,26 @@ var walkdir = require('walkdir'); | ||
var createSpecObj = function(path, root) { | ||
return { | ||
path: function() { return path; }, | ||
relativePath: function() { return path.replace(root, '').replace(/^[\/\\]/, ''); }, | ||
directory: function() { return path.replace(/[\/\\][\s\w\.-]*$/, ""); }, | ||
relativeDirectory: function() { return relativePath().replace(/[\/\\][\s\w\.-]*$/, ""); }, | ||
filename: function() { return path.replace(/^.*[\\\/]/, ''); } | ||
}; | ||
return { | ||
path: function() { return path; }, | ||
relativePath: function() { return path.replace(root, '').replace(/^[\/\\]/, '').replace(/\\/g, '/'); }, | ||
directory: function() { return path.replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); }, | ||
relativeDirectory: function() { return relativePath().replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); }, | ||
filename: function() { return path.replace(/^.*[\\\/]/, ''); } | ||
}; | ||
}; | ||
exports.load = function(loadpath, matcher) { | ||
var wannaBeSpecs = walkdir.sync(loadpath) | ||
var wannaBeSpecs = walkdir.sync(loadpath) | ||
for (var i = 0; i < wannaBeSpecs.length; i++) { | ||
var file = wannaBeSpecs[i]; | ||
try { | ||
if (fs.statSync(file).isFile()) { | ||
if (!/.*node_modules.*/.test(file) && matcher.test(path.basename(file))) { | ||
specs.push(createSpecObj(file)); | ||
} | ||
} | ||
} catch(e) { | ||
// nothing to do here | ||
for (var i = 0; i < wannaBeSpecs.length; i++) { | ||
var file = wannaBeSpecs[i]; | ||
try { | ||
if (fs.statSync(file).isFile()) { | ||
if (!/.*node_modules.*/.test(file) && matcher.test(path.basename(file))) { | ||
specs.push(createSpecObj(file)); | ||
} | ||
} | ||
} catch(e) { | ||
// nothing to do here | ||
} | ||
} | ||
}; | ||
@@ -34,0 +33,0 @@ |
{ | ||
"name" : "jasmine-node" | ||
, "version" : "1.0.23" | ||
, "version" : "1.0.24" | ||
, "description" : "DOM-less simple JavaScript BDD testing framework for Node" | ||
@@ -5,0 +5,0 @@ , "homepage" : [ "http://pivotal.github.com/jasmine" |
@@ -12,3 +12,3 @@ describe('async-callback', function() { | ||
env.it("doesn't wait", function(done) { | ||
this.expect(1+2).toEqual(3); | ||
expect(1+2).toEqual(3); | ||
}); | ||
@@ -32,3 +32,3 @@ }); | ||
env.it("doesn't wait", function(done) { | ||
this.expect(1+2).toEqual(3); | ||
expect(1+2).toEqual(3); | ||
}, 250); | ||
@@ -35,0 +35,0 @@ }); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
121881
32
3527
13