nodejsのクラスメイトは勉強します.


Asertモジュールを使用する必要があります.require('assert').
いくつかの基本関数:
astert.fail(actual、expected、message、operator)
Throws an exception that displays the values for actual and expected separated by the provided operator.
astert(value、message)、astert.ok(value、message)菗
Tests if value is truthy,it is equivalent to assert.equal(true, !!value, message);astert.equal(actual、expected、[message]]
Tests sharow、coercive equality with the equal compriso operator(==).
astert.notEqual(actual、expected、[message]]
Tests sharow、coercive non-equality with the not equal compriso operator(!=).
astert.deepEqual(actual,expected,[message])菗
Tests for deep equality.
astert.not Deep Equal(actual、expected、[message]]
Tests for any deep inequality.
astert.strictEqual(actual,expected,message)菗
Tests strict equality、as determined by the strict equality operator(===)
astert.not StrictEqual(actual,expected,[message])
Tests strict non-equality、as determined by the strict not equal operator(!==)
astert.throws(block,error)[message]
Expects block to throw an error.error can be constructor,regexp or validation function
astert.doesNot Throw(block,message)
Expects block not to throw an error、see astert.throws for details.
astert.ifrerr(value)玣
Tests if value is not a false value、throws if it is a true value.Useful when testing the first argment、error in calbacks.
注意:大文字と小文字を区別します.
astert.ifterにはまだエラーがあるようです.
astert.ifError=function{if}