Commit Graph

30 Commits (5e9c7a92f20877793003887093cf6920fe8d5c99)

Author SHA1 Message Date
isaacs c77312405e lint 2013-04-19 16:25:11 -07:00
Ryan Doenges 6101eb184d assert: put info in err.message, not err.name
4716dc6 made assert.equal() and related functions work better by
generating a better toString() from the expected, actual, and operator
values passed to fail(). Unfortunately, this was accomplished by putting
the generated message into the error's `name` property. When you passed
in a custom error message, the error would put the custom error into
`name` *and* `message`, resulting in helpful string representations like
"AssertionError: Oh no: Oh no".

This commit resolves that issue by storing the generated message in the
`message` property while leaving the error's name alone and adding
a regression test so that this doesn't pop back up later.

Closes #5292.
2013-04-18 15:08:35 -07:00
isaacs 4716dc662d assert: Simplify AssertError creation 2013-04-03 09:52:56 -07:00
lukebayes ae1b0ca7a5 assert: improve support for new execution contexts
More detailed information in GH-693
2012-12-29 11:19:14 -08:00
Ben Noordhuis e4cef1a083 doc: update assert.doesNotThrow() docs
It takes an optional "expected exception" argument that is not used meaningfully
but is nevertheless documented. Undocument it, it confuses casual readers of the
documentation.

Fixes #3935.
2012-08-29 02:36:22 +02:00
koichik 72bc4dcda4 assert: fix throws() throws an error without message property
Fixes #2893.
2012-07-29 19:48:16 +09:00
Nathan Rajlich 9eddaebb79 assert: remove unnecessary use of __proto__
AssertionError already inherits from Error above using util.inherits(),
so this extra line was redundant.

test/simple/test-assert.js already tests for `instanceof`, and still passes.
2012-07-25 10:41:08 -07:00
Nao Iizuka f8ce384446 docs: correct the description of assert.ok() 2012-03-12 02:27:55 +01:00
Maciej Małecki 5c7532e5b3 assert: test `RegExp`'s properties when checking for equality
Previous code ignored the fact that `/a/ != /a/g`.

Test case included.
2011-12-20 00:10:49 +01:00
Pedro Teixeira a805012d6f assert: .deepEqual() support for RegExp objects 2011-12-20 00:10:38 +01:00
Colton Baker 87286cc737 Fixed a lot of jslint errors.
Fixes #1831
2011-10-05 18:51:06 -07:00
Maciej Małecki 8c8d518723 assert: Make `assert` module an `assert.ok` function
Code can be written:

    var assert = require('assert');
    assert(true);

instead of:

    var assert = require('assert');
    assert.ok(true);
2011-10-02 02:25:52 +02:00
Ryan Dahl 0696e78d64 Improve assert error messages
1. actual and expected should be displayed in the same order they were given

2. long values should be truncated.
2011-08-09 14:20:06 -07:00
koichik 5f97c9a005 Improvements AssertionError message
Fixes #217.
2011-07-14 02:08:24 +09:00
Ryan Dahl 5a05992155 Lint 2011-01-06 16:06:27 -08:00
Oleg Slobodskoi 23cf938e4f fix assert.throws 2010-12-21 12:41:57 -08:00
Ryan Dahl db78043d52 lint 2010-12-01 16:42:31 -08:00
Oleg Slobodskoi 02083412eb assert.throws can now accept as RegExp
makes validation of errors more flexible
2010-11-29 17:22:36 -08:00
Micheil Smith e38eb0c5a4 Soft migration of sys -> util, Removal of deprecated utils module. 2010-10-11 15:21:36 -07:00
Joshaven Potter 3d4e4d8909 syntax fixes to pass jslint 2010-10-06 20:40:57 -07:00
Ryan Dahl 1be722a271 Special deepEquals for buffer 2010-09-07 17:14:04 -07:00
Mikeal Rogers fe3d8f2411 Add assert.ifError 2010-05-21 12:06:12 -07:00
isaacs 57fbb627ca trailing whitespace fixes 2010-04-11 14:48:23 -07:00
Ryan Dahl 4ccdc501d4 Include lib/ directory in node executable. Compile on demand.
Instead of installing the files in /usr/lib/node/libraries and loading them
from the file system, the files are built-in to the node executable.
However, they are only compiled on demand.

The reasoning is:
  1. Allow for more complex internal javascript. In particular,
  process.stdout and process.stdin can be js implemented streams.

  2. Ease system installs. Loading from disk each time is unnecessary
  overhead. Note that there is no "system" path for modules anymore. Only
  $HOME/.node_libraries.
2010-03-15 08:04:35 -07:00
Ryan Dahl b021a845f7 Move process.inherits to sys 2010-03-01 11:39:35 -08:00
Ryan Dahl c420c89dbd Make assert.AssertionError instance of Error 2010-01-24 14:39:32 -08:00
Ryan Dahl 0accebe583 Stack trace for asserts shouldn't include assert module 2009-12-29 20:15:05 +01:00
Ryan Dahl dd35637603 Fix assert.js code style 2009-12-29 20:10:59 +01:00
Karl Guertin 4f679fd8d0 Dependency free assert module with unit tests 2009-12-05 01:05:16 +01:00
Felix Geisendörfer 530328f12b CommonJS testing for node.js
Refactored test suite to use the assert module for testing rather than
mjsunit.
2009-12-05 01:05:16 +01:00