New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

deadunit-core

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deadunit-core - npm Package Compare versions

Comparing version 5.0.9 to 5.0.10

serverlessTest.html

13

deadunitCore.js

@@ -52,3 +52,3 @@ "use strict";

var args = arguments
this.manager = EventManager()
this.manager = EventManager(this)

@@ -88,3 +88,3 @@ setTimeout(function() {

var warningInfoMessageHasBeenOutput = false
fakeTest.manager.warningHandler = fakeTest.warningHandler = function(w) {
fakeTest.warningHandler = function(w) {
var errorHandler = getUnhandledErrorHandler()

@@ -123,3 +123,3 @@ if(warningInfoMessageHasBeenOutput === false) {

this.init = function() {
this.init = function(testObject) {
this.handlers = {

@@ -142,5 +142,6 @@ group: [],

this.lastEmitFuture = Future(undefined)
this.testObject = testObject
}
this.warningHandler;
this.testObject; // used to get the right warningHandler

@@ -159,3 +160,3 @@ // emits an event

}).catch(function(e) {
that.warningHandler(e)
that.testObject.warningHandler(e)
})

@@ -174,3 +175,3 @@

this.emitDepth++
if(this.emitDepth % 50 === 0) {
if(this.emitDepth % 40 === 0) { // 40 seems to be the magic number here for firefox - such a finicky browser
that.lastEmitFuture = doStuff(new Future)

@@ -177,0 +178,0 @@ } else {

@@ -15,7 +15,11 @@ "use strict";

var readFileCache = {}
var nodeReadFile = Future.wrap(fs.readFile)
var readFile = function(filePath) {
return nodeReadFile(filePath).then(function(fileBuffer) {
return Future(fileBuffer.toString())
})
if(readFileCache[filePath] === undefined) {
readFileCache[filePath] = nodeReadFile(filePath).then(function(fileBuffer) {
return Future(fileBuffer.toString())
})
}
return readFileCache[filePath]
}

@@ -22,0 +26,0 @@ var exists = function(filePath) {

{"name":"deadunit-core",
"description": "The core for deadunit - a dead-simple nestable unit testing library for javascript in node.js and the browser.",
"keywords": ["unit", "test", "testing", "javascript", "node", "deadunit", "asynchronous"],
"version":"5.0.9",
"version":"5.0.10",
"dependencies":{
"async-future":"1.0.0",
"async-future":"1.0.2",
"stack-trace":"0.0.7",

@@ -16,3 +16,3 @@ "stackinfo":"1.1.3",

"devDependencies": {
"deadunit":"5.1.3",
"deadunit":"5.1.4",
"fibers":"",

@@ -19,0 +19,0 @@ "requirejs":"",

@@ -121,4 +121,6 @@ `deadunitCore`

`this.error(<function>)` - Overrides the unhandled exception handler (that catches errors and records them in the test results) specifically for unhandled errors that happen inside `this` test (not child tests). Unhandled exceptions will come through this function *instead* of being recorded in the test results.
`this.error(<function(e)>)` - Overrides the unhandled exception handler (that catches errors and records them in the test results) specifically for unhandled errors that happen inside `this` test (not child tests). Unhandled exceptions will come through this function *instead* of being recorded in the test results.
`this.warning(<function(e)>)` - Overrides the warning handler (which takes an exception as its parameter). Warning exceptions will come through this function *instead* of being recorded in the test results.
`this.sourcemap(<enable>)` - enables (`true`) or disables (`false`) source mapping of printed exceptions with a given test. Source mapping of exceptions is enabled by default.

@@ -268,2 +270,3 @@

* finish the serverlessTest.html tests, and enable deadunit to work (in a limited way) on files accessed using file:// protocol paths (see here for some help: http://stackoverflow.com/questions/9404793/check-if-same-origin-policy-applies/24619327#24619327 )
* when stacktrace.js supports asynchronous ajax, upgrade it

@@ -307,2 +310,3 @@ * tests are timing out too easily - give each test a default timeout of 1 second (that can be overwritten by an explicit `this.timeout` call)

* 5.0.10 - upgrading async futures, adding test case for the recursion issue, and bolstering "too much recursion" avoidance
* 5.0.9 - fixing too much recursion issue in the tests (affected firefox)

@@ -309,0 +313,0 @@ * 5.0.8 - attempting to fix some bugs in the last commit

@@ -6,6 +6,6 @@

module.exports = function(Unit) {
module.exports = function(Unit, testEnvironment) {
return function(t) {
//this.count(2)
//this.timeout(10 * 1000)
this.count(2)
this.timeout(15*1000)
var browserSpecificFutures = []

@@ -28,26 +28,28 @@

this.test('sourcemap', function(t) {
this.count(5)
this.timeout(2000)
if(testEnvironment === 'web') {
this.test('sourcemap', function(t) {
this.count(5)
this.timeout(2000)
var f = new Future; browserSpecificFutures.push(f)
var unittest = Unit.test(function() {
this.test('webpack source map file', window.sourceMapTest3)
}).events({
end: function(e) {
var results = unittest.results()
var f = new Future; browserSpecificFutures.push(f)
var unittest = Unit.test(function() {
this.test('webpack source map file', window.sourceMapTest3)
}).events({
end: function(e) {
var results = unittest.results()
t.ok(results.results[0].results[0].line === 4)
t.ok(results.results[0].results[0].sourceLines === 'this.ok(true)')
t.ok(results.results[0].exceptions.length === 1)
t.ok(results.results[0].exceptions[0].message === "webpack bundle error")
t.ok(results.results[0].exceptions[0].stack.match(/sourceMapTest3 \(.*webpackTest.js:5(:[0-9]+)?\)/) !== null, results.results[0].exceptions[0].stack)
t.log(results.results[0].exceptions[0])
t.ok(results.results[0].results[0].line === 4)
t.ok(results.results[0].results[0].sourceLines === 'this.ok(true)')
t.ok(results.results[0].exceptions.length === 1)
t.ok(results.results[0].exceptions[0].message === "webpack bundle error")
t.ok(results.results[0].exceptions[0].stack.match(/sourceMapTest3 \(.*webpackTest.js:5(:[0-9]+)?\)/) !== null, results.results[0].exceptions[0].stack)
t.log(results.results[0].exceptions[0])
f.return()
}
f.return()
}
})
})
})
}
// note: this test used to cause a stack loop that crashed chrome and blew firefoxes memory usage way up (probably until it'd crash too)
// note: this test used to cause a stack loop that crashed chrome and blew firefox's memory usage way up (probably until it'd crash too)
this.test('ajax failure', function(t) {

@@ -105,3 +107,3 @@ this.count(4)

Future.all(browserSpecificFutures).then(function() {
t.test("common tests", tests.getTests(Unit, 'web', {return: function(){}}))
t.test("common tests", tests.getTests(Unit, testEnvironment, {return: function(){}}))
})

@@ -108,0 +110,0 @@ //*/

@@ -9,3 +9,3 @@ "use strict";

if(testEnvironment === 'web') {
if(testEnvironment === 'web' || testEnvironment === 'web_fileProtocol') {
var testFileName = "deadunitTests.browser.umd.js"

@@ -34,2 +34,9 @@

function catchWarningsIfNeccessary(that) {
if(testEnvironment === 'web_fileProtocol') {
that.warning(function(e) {
console.log(e.message)
})
}
}

@@ -71,2 +78,3 @@ //*

var test = Unit.test(function() {
catchWarningsIfNeccessary(this)
this.count(1)

@@ -96,2 +104,3 @@ this.timeout(0) // just to make the test end faster

var simpleAsyncExceptionTest = Unit.test(function(t) {
catchWarningsIfNeccessary(this)
this.count(1)

@@ -256,6 +265,6 @@ setTimeout(function() {

if(testEnvironment === 'node') {
var subtest3line = 141
var subtest3line = 150
this.ok(subtest3.line === subtest3line, subtest3.line)
} else {
var subtest3line = 7894
var subtest3line = 7920
this.ok(subtest3.line === subtest3line, subtest3.line) // browserify bug causes sourcemap to not be found

@@ -682,2 +691,3 @@ }

Unit.test('one', function() {
this.timeout(9000) // because ie is slow
this.log("string")

@@ -805,3 +815,3 @@ this.ok(false, "string")

t.test('former bugs', function() {
this.count(2)
this.count(3)

@@ -857,2 +867,19 @@ this.test('deadunit would crash if an asynchronous error was thrown in the top-level main test', function(t) {

})
// note: I couldn't get this to cause too much recursion in node.js no matter how high I set maxN
// but it manifested in Chrome as a crash and Firefox as a "too much recursion" error
this.test('too much recursion / EMFILE issue', function(t) {
this.count(1)
var maxN = 1000
var unittest = Unit.test(function() {
for(var n=0; n<maxN; n++) {
this.ok(true)
}
}).events({
end: function(e) {
var results = unittest.results()
t.eq(results.results.length, maxN)
}
})
})
})

@@ -859,0 +886,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc