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

jasminum

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasminum - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

CHANGES.md

6

expectation.js

@@ -156,2 +156,8 @@

Expectation.prototype.toThrow = function () {
if (typeof this.value !== "function") {
this.report.assert(false, false, [
"expected function but got"
], [this.value]);
return;
}
try {

@@ -158,0 +164,0 @@ this.value();

4

package.json
{
"name": "jasminum",
"version": "0.0.3",
"version": "0.0.4",
"description": "A light, modular, promissory, isomorphic Jasmine test scaffold clone",

@@ -35,4 +35,4 @@ "keywords": [

"scripts": {
"test": "node runner.js test && node phantom/runner.js test"
"test": "node runner.js test"
}
}

@@ -18,8 +18,17 @@

if (typeof stack === "string") {
return stack.replace(/^[^\n]*\n[^\n]\n/, "");
} else {
return stack;
stack = stack.replace(/^[^\n]*\n[^\n]\n/, "");
stack = annotateStackTrace(stack);
}
return stack;
}
function annotateStackTrace(stack) {
if (stack && colors) {
stack = stack.replace(/\n ([^\n]+\-(?:spec|test)\.js[^\n]+)/g, function ($0, $1) {
return ("\n → " + $1).bold;
});
}
return stack;
}
module.exports = Reporter;

@@ -42,5 +51,10 @@ function Reporter(options) {

var child = Object.create(this);
child.test = test;
child.parent = this;
child.depth = this.depth + 1;
child.failed = false;
// A test passes if all assertions pass.
// A test that should fail passes if any assertion fails.
// Tests that [should fail] exist only for validating the test runner
// itself and is only necessarily implemented by this test reporter.
child.failed = test.shouldFail;
child.skipped = false;

@@ -67,3 +81,3 @@ var message = (Array(child.depth + 1).join("❯") + " " + test.type + " " + test.name + (test.async ? " async".white : ""));

if (this.showFails && this.failed) {
console.log((Array(this.depth + 1).join("⬆") + " " + test.type + " " + test.name).grey);
console.log((Array(this.depth + 1).join("↑") + " " + test.type + " " + test.name).grey);
}

@@ -91,3 +105,3 @@ if (this.failed && this.parent && this.parent.parent) {

var passed = !guard === isNot;
if (!passed || this.showPasses) {
if ((!passed && !this.test.shouldFail) || this.showPasses) {
for (var index = 0; index < Math.max(messages.length, objects.length); index++) {

@@ -102,3 +116,3 @@ if (index < messages.length) {

if (colors) {
if (passed) {
if (passed !== this.test.shouldFail) {
message = message.green;

@@ -116,19 +130,38 @@ } else {

}
if (!passed) {
var stack = getStackTrace();
if (!passed && !this.test.shouldFail) {
var stack = annotateStackTrace(getStackTrace());
if (stack) {
console.log(stack);
}
this.failed = true;
this.root.failedAssertions++;
} else {
this.root.passedAssertions++;
}
if (passed) { // passed
if (this.test.shouldFail) { // but should fail
this.failed = false;
} else { // and passed
this.root.passedAssertions++;
}
} else { // failed
if (!this.test.shouldFail) { // but should pass
this.failed = true;
this.root.failedAssertions++;
} else { // and should fail
this.failed = false;
this.root.passedAssertions++;
}
}
};
Reporter.prototype.error = function (error, test) {
this.failed = true;
this.root.errors++;
console.log("error".red);
console.error(error && error.stack ? error.stack : error);
if (this.test.shouldFail) {
this.failed = false;
} else {
console.log(colors ? "error".red : "error");
if (typeof error.stack === "string") {
console.log(annotateStackTrace(error.stack));
} else if (error) {
console.log(error);
}
this.failed = true;
this.root.errors++;
}
};

@@ -141,3 +174,7 @@

self.failed++;
console.log("test never completes: add a timeout".red);
if (colors) {
console.log("test never completes".red);
} else {
console.log("test never completes");
}
self.exit(code !== 0);

@@ -144,0 +181,0 @@ };

@@ -14,2 +14,4 @@ #!/usr/bin/env node

Error.stackTraceLimit = Infinity;
search(argv._).then(function (files) {

@@ -16,0 +18,0 @@

@@ -11,2 +11,5 @@ // vim:ts=4:sts=4:sw=4:

this.skip = !callback;
// The [should fail] directive in a test name exists solely for the purpose
// of testing the test runner itself.
this.shouldFail = /\[should fail\]/.test(name);
}

@@ -13,0 +16,0 @@

@@ -328,2 +328,6 @@

});
it("[should fail] checks whether the value is a function", function () {
expect(undefined).not.toThrow();
});
});

@@ -511,7 +515,7 @@

xit("[should fail] expects the resolution of a promse to be undefined", function () {
it("[should fail] expects the resolution of a promse to be undefined", function () {
return Q(10);
});
xit("[should fail] expects the promise ot be fulfilled", function () {
it("[should fail] expects the promise ot be fulfilled", function () {
return Q().then(function () {

@@ -518,0 +522,0 @@ throw new Error("Should fail");

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