Commit graph

88 commits

Author SHA1 Message Date
Isiah Meadows
b98ab29efd
Make errors and their messages more accurate and helpful (#2536)
Also, I normalized them to all be sentences for consistency, and I moved
the reentrancy check from `m.mount` to `m.render` to be a little more
helpful. The router change during mounting is inconsequential and only
to avoid the new modified error, and the change to the update loop is to
send the original error if an error occurred while initializing the
default route. (This is all around more useful anyways.)

And while I was at it, I fixed an obscure bug with sync redraws.
2019-09-30 16:08:04 -04:00
soulofmischief
0ea6a190b6 Fix assertion descriptions (#2405)
* Fix assertion descriptions

Move return statement to the end of define()

* ospec: Fix assertion definitions

* Fix typo in assertion

* Add test for descriptions being returned on fail

* Reference result instead of self in returned description method

* Fix style errors
2019-09-22 03:35:07 -04:00
Isiah Meadows
39fa2b32c2
Fix #1881 + related ospec bug (#2492)
* Fix #1881 + related ospec bug

* Test duplicate resolves, update changelog
2019-07-26 18:19:40 -04:00
Robin (Robert) Thomas
b5219920ab Ospec: expose messages for passing tests, in addition to failing tests (#2227)
* ospec: all results, failing and passing, include .message and .context

Previously only failing tests had .message and .context.

* Updated docs

* Function was ugly

* Ospec verbose passing tests: put changelog update in right place
2018-11-21 15:47:10 -05:00
Robin (Robert) Thomas
0fd1bc9cae Add 'throws'/'notThrows' assertion to Ospec for error reporting (#2255)
* Ospec: added assertion that function does/doesnt throw error

* Ospec.throws passes npm test

* Ospec.throws: Address requested changes

* Ospec: message comparison support for .throws/.notthrows

Credit to @maranomynet, #2227
2018-11-21 15:46:34 -05:00
Isiah Meadows
2635070734 Merge branch 'next' 2018-10-25 14:23:33 -04:00
Isiah Meadows
f844cc8134 Add functionality for inspecting arbitrary past calls
This made it much easier to debug multiple calls while developing this
patch.
2018-09-20 15:08:49 -04:00
Pierre-Yves Gérardy
3f5cabc5c5 Chore: Normalize the way we use eslint-disable 2018-06-01 21:27:02 +02:00
Pierre-Yves Gérardy
14695c9cda [ospec] Allow more than one o.only() test 2018-06-01 20:22:58 +02:00
Pierre-Yves Gérardy
a23216b987 [ospec] record errors thrown in tests as failures 2018-06-01 20:22:58 +02:00
Pierre-Yves Gérardy
53597871b8 [ospec] don't allocate task for tests that will be skipped in o.only mode, fix stack overflow 2018-06-01 20:22:58 +02:00
Pierre-Yves Gérardy
aa0f9eae98 [ospec] o.defaultTimeout => o.specTimeout, and documentation.
The timeout parameter is deprecated but will still work for now
2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
25975c5ce4 [ospec] Restore the assertion success on async test finalization in time 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
8ebf036b8c [ospec] Improve the done() call checker 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
33180370ea [ospec] Change the reserved test name token from '__' to '\x01' 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
0574d193a0 [ospec] better variable name 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
285d00742d [ospec] Detect incomplete assertions 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
e342805bfb [ospec] Add o.defaultTimeout() 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
9c1f8d5f35 [ospec] cleanup in code and tests, better error messages 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
e473536866 [ospec] cleanup o.only 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
64680425e7 [ospec] Add o.timeout() to set a timeout for Promise-based async tests 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
b292f75bd8 [ospec] don't count succesful async test termination as a test success 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
89b665fbf6 [ospec] revamp async testing finalization 2018-05-29 22:42:20 +02:00
Pierre-Yves Gérardy
ff1a07df1b [ospec] give async timeouts a proper stack trace 2018-05-29 22:42:20 +02:00
Gilbert
0f498e0aec Fix stack trace edge case 2018-05-25 17:45:01 +02:00
Pierre-Yves Gérardy
010d8daae9 [ospec] pinpoint the o.only() call site 2018-05-22 18:35:26 +02:00
Már Örlygsson
2794ceb76f [ospec] Make the default reporting nicer looking (#2147)
* feat(ospec): Add spacing before report results

...sometimes tested code emits console.log() messages
which then blend in with ospec's report

* feat(ospec): Reword and prettify the report messages

* feat(ospec): Make console.errors more compact, yet more readable

* docs(ospec): Update change-log.md

* fix(ospec): Fix grammar when number of assertions is 1

* feat(ospec): Make "all passed" message bright green

* refactor(ospec): define `cStyle()` helper for browser styling

* feat(ospec): Use en-dashes for the horizontal divider

* feat(ospec): Revert stacktrace coloring, make context bright red

...and add extra newline above each error - for readability
in commandline (node.js) mode

* feat(ospec): Improve the only-test-passed message

"1 assertion passed" --> "The 1 assertion passed"

* docs: Update LOC count
2018-05-22 18:19:54 +02:00
Pierre-Yves Gérardy
43053c6088
[ospec] don't output colors when pipe or file redirection is used (#2143) 2018-05-09 07:58:47 +02:00
Pierre-Yves Gérardy
4818109c9a
Merge branch 'next' into iss-1798 2018-05-04 14:08:39 +02:00
Pierre-Yves Gérardy
d2e80f7345
A more general fix 2018-05-04 14:05:42 +02:00
Pierre-Yves Gérardy
ff330e5605 Expose the reporter as o.report(results), have it return the number of errors 2017-12-01 00:29:26 +01:00
Pierre-Yves Gérardy
3164031ba4 Make the stack trace cleaner IE9 compatible (err.stack is null) 2017-12-01 00:29:14 +01:00
Pierre-Yves Gérardy
7caebddcb2 ospec: better stack trace filter, fix #2036 2017-12-01 00:28:59 +01:00
Pierre-Yves Gérardy
1f9a9c0ef8 Make the stack trace filter path-independent (auto-detection vs. hardcoded previously) 2017-12-01 00:28:13 +01:00
Pierre-Yves Gérardy
71de4fa6c9 Pop report() off the stack (for better Flems output) 2017-12-01 00:27:21 +01:00
Pierre-Yves Gérardy
af35e4b446 Make ospec work natively in browser environments 2017-12-01 00:27:08 +01:00
Pierre-Yves Gérardy
769c854f82 Expose the reporter as o.report(results), have it return the number of errors 2017-11-30 23:25:31 +01:00
Pierre-Yves Gérardy
acd08c96dd Make the stack trace cleaner IE9 compatible (err.stack is null) 2017-11-30 23:00:26 +01:00
Pierre-Yves Gérardy
b84e09369e ospec: better stack trace filter, fix #2036 2017-11-30 16:10:14 +01:00
Pierre-Yves Gérardy
0873cb53cc Make the stack trace filter path-independent (auto-detection vs. hardcoded previously) 2017-11-30 00:27:08 +01:00
Pierre-Yves Gérardy
b38ba7c934 Pop report() off the stack (for better Flems output) 2017-11-29 22:15:45 +01:00
Pierre-Yves Gérardy
f06510bb62 Make ospec work natively in browser environments 2017-11-29 22:15:45 +01:00
Sage Gerard
4a72829985 feat(ospec): Allow custom reporters for CI reasons (#2019) (#2020) 2017-11-29 17:03:38 +01:00
spacejack
d4181d17c8 Silence global-require rule in ospec, add ecma 2017 parser to eslintrc for async/await in test-ospec 2017-11-29 17:02:53 +01:00
Roderic Day
69045af46c Handle newlines in error messages, fixes #1495 2017-11-29 17:00:54 +01:00
Rasmus Porsager
7f2ff03ecf Use util.inspect to log in node - fixes #1661 2017-11-29 16:53:00 +01:00
Stephan Hoyer
fad8a7286b Support err as first argument for done callbacks in async tests 2017-11-29 16:50:08 +01:00
Stephan Hoyer
9b5afff52e Support promise return in ospec 2017-11-29 16:49:54 +01:00
Sage Gerard
78eeb2b365 feat(ospec): Allow custom reporters for CI reasons (#2019) (#2020) 2017-11-20 15:37:07 -08:00
Isiah Meadows
3c608f26b7
Merge pull request #1984 from RodericDay/newlines-in-error-messages
Handle newlines in error messages, fixes #1495
2017-10-28 20:20:34 -04:00