Comparing version 3.0.3 to 3.1.0
3.1.0 / 2016-02-24 | ||
================== | ||
* feat: debug from COFFEE_DEBUG | ||
* feat: add .notExpect method | ||
3.0.3 / 2016-01-14 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -9,2 +9,5 @@ 'use strict'; | ||
expected.forEach(function(rule) { | ||
let isOpposite = rule.isOpposite; | ||
rule = rule.value; | ||
if (Array.isArray(rule)) { | ||
@@ -19,12 +22,14 @@ return module.exports(rule, actual, message); | ||
debug('actual: `%s`, expected: `%s`', show(actual), show(rule)); | ||
debug('actual: `%s`, expected: `%s`, isOpposite: `%s`', show(actual), show(rule), isOpposite); | ||
const msg = 'should' + (isOpposite ? ' not ' : ' ') + message; | ||
if (rule instanceof RegExp) { | ||
return assert(rule.test(actual), | ||
message + ' expected `' + show(rule) + '` but actual `' + show(actual) + '`'); | ||
return assert.strictEqual(rule.test(actual), !isOpposite, | ||
msg + ' expected `' + show(rule) + '` but actual `' + show(actual) + '`'); | ||
} | ||
assert.strictEqual(actual, rule, | ||
message + ' expected `' + show(rule) + '` but actual `' + show(actual) + '`'); | ||
assert[isOpposite ? 'notStrictEqual' : 'strictEqual'](actual, rule, | ||
msg + ' expected `' + show(rule) + '` but actual `' + show(actual) + '`'); | ||
}); | ||
}; |
@@ -10,2 +10,3 @@ 'use strict'; | ||
var show = require('./show'); | ||
var Rule = require('./rule'); | ||
@@ -47,6 +48,6 @@ // init coffee_inject_istanbul env | ||
try { | ||
assertion(self.waitAssert.stdout, self.stdout, 'should match stdout'); | ||
assertion(self.waitAssert.stderr, self.stderr, 'should match stderr'); | ||
assertion(self.waitAssert.code, self.code, 'should match code'); | ||
self.error && assertion(self.waitAssert.error, self.error.message, 'should match error message'); | ||
assertion(self.waitAssert.stdout, self.stdout, 'match stdout'); | ||
assertion(self.waitAssert.stderr, self.stderr, 'match stderr'); | ||
assertion(self.waitAssert.code, self.code, 'match code'); | ||
self.error && assertion(self.waitAssert.error, self.error.message, 'match error message'); | ||
} catch (err) { | ||
@@ -69,2 +70,6 @@ return done(err); | ||
if (process.env.COFFEE_DEBUG) { | ||
this.debug(process.env.COFFEE_DEBUG); | ||
} | ||
process.nextTick(this._run.bind(this)); | ||
@@ -89,7 +94,7 @@ } | ||
// 2 -> stderr | ||
switch (level) { | ||
case 1: | ||
switch (String(level)) { | ||
case '1': | ||
this._debug_stdout = true; | ||
break; | ||
case 2: | ||
case '2': | ||
this._debug_stderr = true; | ||
@@ -107,6 +112,7 @@ break; | ||
var acceptType = ['stdout', 'stderr', 'code', 'error']; | ||
Coffee.prototype.expect = function(type, value) { | ||
assert(!this._isEndCalled, 'can\'t call expect after end'); | ||
if (acceptType.indexOf(type) > -1) { | ||
this.waitAssert[type].push(value); | ||
this.waitAssert[type].push(new Rule(value)); | ||
} | ||
@@ -116,2 +122,10 @@ return this; | ||
Coffee.prototype.notExpect = function(type, value) { | ||
assert(!this._isEndCalled, 'can\'t call notExpect after end'); | ||
if (acceptType.indexOf(type) > -1) { | ||
this.waitAssert[type].push(new Rule(value, true)); | ||
} | ||
return this; | ||
}; | ||
/* | ||
@@ -118,0 +132,0 @@ Write data to stdin of the command |
{ | ||
"name": "coffee", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "Test command line on nodejs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -101,2 +101,6 @@ # Coffee | ||
#### coffee.notExpect(type, expected) | ||
The opposite assertion of `expect`. | ||
#### coffee.write(data) | ||
@@ -120,2 +124,4 @@ | ||
Alternative you can use `COFFEE_DEBUG` env. | ||
#### coffee.coverage() | ||
@@ -122,0 +128,0 @@ |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
15042
10
306
135
15