jasmine-node
Advanced tools
Comparing version 2.0.0-beta1 to 2.0.0-beta2
(function() { | ||
var booter, fileFinder, fs, growlReporter, isWindowDefined, jasmineEnv, jasmineSrc, jasminejs, key, mkdirp, nodeReporters, path, print, removeJasmineFrames, util, value, vm, _; | ||
var booter, context, contextObj, executeSpecsInFolder, fileFinder, fs, isWindowDefined, jasmineEnv, jasmineSrc, jasminejs, loadHelpersInFolder, mkdirp, path, print, removeJasmineFrames, util, vm, _; | ||
@@ -8,4 +8,2 @@ _ = require('underscore'); | ||
growlReporter = require('jasmine-growl-reporter'); | ||
mkdirp = require('mkdirp'); | ||
@@ -23,4 +21,2 @@ | ||
nodeReporters = require('./reporter'); | ||
isWindowDefined = global.window != null; | ||
@@ -41,17 +37,14 @@ | ||
vm.runInThisContext(jasmineSrc, jasminejs); | ||
contextObj = { | ||
window: global.window, | ||
console: console | ||
}; | ||
jasmineEnv = booter.boot(global.window.jasmineRequire); | ||
context = vm.createContext(contextObj); | ||
jasmineEnv['jasmine'] = jasmineEnv; | ||
vm.runInContext(jasmineSrc, context, jasminejs); | ||
if (!isWindowDefined) { | ||
delete global.window; | ||
} | ||
jasmineEnv = booter.boot(global.window.jasmineRequire); | ||
jasmineEnv.TerminalReporter = nodeReporters.TerminalReporter; | ||
jasmineEnv.GrowlReporter = growlReporter; | ||
jasmineEnv.loadHelpersInFolder = function(folder, matcher) { | ||
loadHelpersInFolder = function(folder, matcher) { | ||
var e, file, folderStats, help, helper, helpers, key, matchedHelpers, _i, _len; | ||
@@ -99,4 +92,4 @@ folderStats = fs.statSync(folder); | ||
jasmineEnv.executeSpecsInFolder = function(options) { | ||
var defaults, error, funcName, jasFunc, jasmine, matchedSpecs, reporterOptions, spec, specsList, _i, _len; | ||
executeSpecsInFolder = function(options) { | ||
var defaults, error, jasmine, matchedSpecs, reporterOptions, spec, specsList, _i, _len; | ||
defaults = { | ||
@@ -108,6 +101,2 @@ regExpSpec: new RegExp(".(js)$", "i"), | ||
jasmine = jasmineEnv.getEnv(); | ||
for (funcName in jasmine) { | ||
jasFunc = jasmine[funcName]; | ||
global[funcName] = jasFunc; | ||
} | ||
matchedSpecs = fileFinder.find(options.specFolders, options.regExpSpec); | ||
@@ -139,14 +128,10 @@ jasmine.addReporter(new jasmineEnv.TerminalReporter(reporterOptions)); | ||
print = function(str) { | ||
return process.stdout.write(util.format(str)); | ||
process.stdout.write(util.format(str)); | ||
}; | ||
for (key in jasmineEnv) { | ||
value = jasmineEnv[key]; | ||
exports[key] = value; | ||
} | ||
module.exports = { | ||
executeSpecsInFolder: executeSpecsInFolder, | ||
loadHelpersInFolder: loadHelpersInFolder | ||
}; | ||
exports['setTimeout'] = jasmineEnv.getGlobal().setTimeout; | ||
exports['setInterval'] = jasmineEnv.getGlobal().setInterval; | ||
}).call(this); |
(function() { | ||
var boot; | ||
var boot, growlReporter, nodeReporters; | ||
growlReporter = require('jasmine-growl-reporter'); | ||
nodeReporters = require('../reporter'); | ||
boot = function(jasmineRequire) { | ||
@@ -24,2 +28,4 @@ var env, extend, jasmine, jasmineInterface; | ||
env = jasmine.getEnv(); | ||
jasmine.TerminalReporter = nodeReporters.TerminalReporter; | ||
jasmine.GrowlReporter = growlReporter; | ||
@@ -59,5 +65,8 @@ /* | ||
}, | ||
jsApiReporter: new jasmine.JsApiReporter({ | ||
timer: new jasmine.Timer() | ||
}) | ||
setTimeout: function(cb, ms) { | ||
return env.setTimeout(cb, ms); | ||
}, | ||
setInterval: function(cb, ms) { | ||
return env.setInterval(cb, ms); | ||
} | ||
}; | ||
@@ -68,3 +77,4 @@ | ||
*/ | ||
extend(exports, jasmineInterface); | ||
extend(global, jasmineInterface); | ||
global.jasmine = jasmine; | ||
@@ -71,0 +81,0 @@ /* |
@@ -795,19 +795,19 @@ /* | ||
Any.prototype.jasmineMatches = function(other) { | ||
if (this.expectedObject == String) { | ||
if (typeof this.expectedObject() === 'string') { | ||
return typeof other == 'string' || other instanceof String; | ||
} | ||
if (this.expectedObject == Number) { | ||
if (typeof this.expectedObject() === 'number') { | ||
return typeof other == 'number' || other instanceof Number; | ||
} | ||
if (this.expectedObject == Function) { | ||
if (typeof this.expectedObject() == 'function') { | ||
return typeof other == 'function' || other instanceof Function; | ||
} | ||
if (this.expectedObject == Object) { | ||
if (typeof this.expectedObject() == 'object') { | ||
return typeof other == 'object'; | ||
} | ||
if (this.expectedObject == Boolean) { | ||
if (typeof this.expectedObject() == 'boolean') { | ||
return typeof other == 'boolean'; | ||
@@ -820,3 +820,3 @@ } | ||
Any.prototype.jasmineToString = function() { | ||
return '<jasmine.any(' + this.expectedClass + ')>'; | ||
return '<jasmine.any(' + this.expectedObject + ')>'; | ||
}; | ||
@@ -823,0 +823,0 @@ |
@@ -7,10 +7,4 @@ (function() { | ||
util = null; | ||
util = require('util'); | ||
try { | ||
util = require('util'); | ||
} catch (_error) { | ||
util = require('sys'); | ||
} | ||
noOp = function() {}; | ||
@@ -71,5 +65,5 @@ | ||
defaults = { | ||
color: this.config.noColor ? this.NoColors : this.ANSIColors, | ||
noStackTrace: true, | ||
onComplete: noOp, | ||
noStackTrace: true, | ||
verbose: false, | ||
print: function(str) { | ||
@@ -80,6 +74,6 @@ process.stdout.write(util.format(str)); | ||
return t; | ||
} | ||
}, | ||
verbose: false | ||
}; | ||
this.config = _.defaults(this.config, defaults); | ||
this.config.color = this.config.noColor ? this.NoColors : this.ANSIColors; | ||
this.counts = { | ||
@@ -86,0 +80,0 @@ tests: 0, |
(function() { | ||
var autoTest, coffee, exitCode, fs, help, jasmine, key, minimist, minimistOpts, onExit, parseArgs, path, printVersion, runSpecs, util, value, _, | ||
var autoTest, coffee, exitCode, fs, help, jasmine, minimist, minimistOpts, onExit, parseArgs, path, printVersion, runSpecs, util, _, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -21,7 +21,2 @@ | ||
for (key in jasmine) { | ||
value = jasmine[key]; | ||
global[key] = value; | ||
} | ||
minimistOpts = { | ||
@@ -73,3 +68,3 @@ boolean: ["autoTest", "captureExceptions", "coffee", "forceExit", "growl", "h", "help", "matchAll", "noColor", "noStackTrace", "verbose", "version"], | ||
parseArgs = function() { | ||
var allowed, options, spec, _i, _len, _ref; | ||
var allowed, key, options, spec, _i, _len, _ref; | ||
options = minimist(process.argv.slice(2), minimistOpts); | ||
@@ -76,0 +71,0 @@ for (key in options) { |
{ | ||
"name": "jasmine-node", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0-beta2", | ||
"description": "DOM-less simple JavaScript BDD testing framework for Node", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -0,5 +1,7 @@ | ||
![Jasmine Node](/res/JasmineNode.png) | ||
NOTE | ||
==== | ||
This branch is in-development. Not recommended for use | ||
This branch is in-development. Not recommended for production use | ||
@@ -6,0 +8,0 @@ jasmine-node |
@@ -15,2 +15,41 @@ describe('jasmine-node-flat', function(){ | ||
describe('jasmine.any tests', function() { | ||
it('handles string and not string', function() { | ||
expect('abc').toEqual(jasmine.any(String)); | ||
expect(function(){}).not.toEqual(jasmine.any(String)); | ||
expect(123123).not.toEqual(jasmine.any(String)); | ||
expect({a:true}).not.toEqual(jasmine.any(String)); | ||
expect(true).not.toEqual(jasmine.any(String)); | ||
}); | ||
it('handles number and not number', function() { | ||
expect(123123).toEqual(jasmine.any(Number)); | ||
expect('abc').not.toEqual(jasmine.any(Number)); | ||
expect(function(){}).not.toEqual(jasmine.any(Number)); | ||
expect({a:true}).not.toEqual(jasmine.any(Number)); | ||
expect(true).not.toEqual(jasmine.any(Number)); | ||
}); | ||
it('handles function and not function', function() { | ||
expect(function(){}).toEqual(jasmine.any(Function)); | ||
expect(123123).not.toEqual(jasmine.any(Function)); | ||
expect('abc').not.toEqual(jasmine.any(Function)); | ||
expect({a:true}).not.toEqual(jasmine.any(Function)); | ||
expect(true).not.toEqual(jasmine.any(Function)); | ||
}); | ||
it('handles object and not object', function() { | ||
expect({a:true}).toEqual(jasmine.any(Object)); | ||
expect(function(){}).not.toEqual(jasmine.any(Object)); | ||
expect(123123).not.toEqual(jasmine.any(Object)); | ||
expect('abc').not.toEqual(jasmine.any(Object)); | ||
expect(true).not.toEqual(jasmine.any(Object)); | ||
}); | ||
it('handles boolean and not boolean', function() { | ||
expect(true).toEqual(jasmine.any(Boolean)); | ||
expect({a:true}).not.toEqual(jasmine.any(Boolean)); | ||
expect(function(){}).not.toEqual(jasmine.any(Boolean)); | ||
expect(123123).not.toEqual(jasmine.any(Boolean)); | ||
expect('abc').not.toEqual(jasmine.any(Boolean)); | ||
}); | ||
}); | ||
describe('beforeEach Timeout', function(){ | ||
@@ -17,0 +56,0 @@ beforeEach(function(done) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
308283
245
8
5355