Commit Graph

1354 Commits

Author SHA1 Message Date
Sheel Choksi 06a553503d Better failure message when something is thrown that's not an error
Change from 'undefined : undefined' to '<thing that was thrown> thrown'

Pointed out by @charleshansen
2014-01-09 22:10:40 -08:00
Sheel Choksi b525313cdb Make the check for pending spec exception work for values that don't have toString 2014-01-04 23:11:20 -08:00
pimterry 3b52d015ea Track return values of spy functions 2013-12-08 13:40:24 +00:00
Maciej Filip Szkodziński 555d328cf2 Moved last currentTime assignment to tick. 2013-11-17 17:14:29 -08:00
Maciej Filip Szkodziński c78fba4b13 Sets and executes timeouts set during a tick.
All timeouts and intervals set during a tick were being scheduled to run
at delay + end-of-tick, instead of delay + time-of-outer-timeout.

Scheduled run-at times were shifted because currentTime was being
incremented before executing scheduled functions.

Additionally, the execute loop was iterating over a functions-to-run
array, created from scheduledFunctions before starting. Any changes to
scheduledFunctions were being ignored during the tick, and the next tick
would ignore any functions which should have been executed in the past.

The commit is a rewrite of DelayedFunctionScheduler, preserving the
public interface. Execution of scheduled functions updates currentTime
on each iteration, and each time takes the functions with the lowest
runAtMillis from the schedule, if they aren't higher than endTime.
2013-11-17 17:14:29 -08:00
Sheel Choksi 8a6d7828c6 Make all async functions be subject to the timeout
[finishes #60798058]
2013-11-14 23:01:43 -08:00
Sheel Choksi c888b0c1b8 Slight refactoring of clearing timeouts when an exception is thrown 2013-11-14 20:48:28 -08:00
Sheel Choksi 614a18453e Rename Spec's queueRunner to more accurately be a queueRunnerFactory 2013-11-11 20:53:13 -08:00
François Daoust 775e2ff0a9 Clears timeout timer even when async spec throws an exception
When an async spec throws a (sync) exception for some reason, the
exception was correctly caught and reported by Jasmine but the timeout
timer continued to run in the background.

For instance, running the (rather stupid) example below would report
the exception immediately but would also make the process loop for 5s
(and report the exception depending on the reported being used).

describe('exception', function () {
  it('is caught but timer continues to run', function (done) {
    throw new Error('Oh no!');
  });
});

This happened because the timout timer is set in Spec while the
"try... catch" block is in the queue runner. The "callDone" function
of "timeoutable" that resets the timer was thus not called.

The commit simply introduces a "try... catch" block within the
`timeoutable` function to ensure that "callDone" gets called even
when an exception is thrown.
2013-11-07 14:51:46 +01:00
JR and Sheel Choksi 6e07dccb68 Make getGlobal() work in strict mode
Slight modifications to implementation in pull #437
2013-11-01 11:06:57 -07:00
Kristóf Marussy 4350045d61 Replaced deprecated octal literal with hexadecimal
Octal literals are deprecated in JavaScript 1.5 and Gjs were generating
warnings because of them.
2013-10-31 14:03:06 -07:00
Sheel Choksi 8585ef69a5 Update clock not installed message to reflect current boot installation process 2013-10-29 17:33:51 -07:00
Sheel Choksi a03fad8911 Move built console.js into lib and include in standalone distribution
[finishes #59679110]
2013-10-29 14:03:01 -07:00
Sheel Choksi 61993cf1fc Expose Jasmine's topSuite [finishes #59774024] 2013-10-29 11:27:12 -07:00
Kyriacos Souroullas and Sheel Choksi cd9d5284cd Matchers can have a negativeCompare
- Passing in a 'negativeCompare' will cause that function to be used when it is a 'not' assertion
- Otherwise, the reversal of the compare's result will be used instead

[finishes #59703824]
2013-10-28 17:13:18 -07:00
Kyriacos Souroullas and Sheel Choksi e346e7dcc1 Revert removal of compare nesting
Since we want the user to be able to pass a negative comparison function, the extra layer of wrapping is now needed
2013-10-28 17:13:09 -07:00
Davis W. Frank 9e149d1e0f Move node dev deps forward, add .jshintrc to support latest grunt-contrib-jshint and Code Climate score 2013-10-25 12:23:57 -07:00
Sheel Choksi and Tim Jarratt 797984f173 Add newlines to end of files 2013-10-25 10:57:43 -07:00
Sheel Choksi and Tim Jarratt 29c5c127e5 Refactor Suite.addSpec and .addSuite to .addChild 2013-10-25 10:52:31 -07:00
Sheel Choksi and Tim Jarratt 26581b4c91 Rename Suite.children_ to .children
Also removed some unit tests that were brittle, and already tested by
better, more round-trip tests.
2013-10-25 10:25:50 -07:00
Javier López Pardo 81b822fea9 Add specs for mock date 2013-10-25 14:41:32 +02:00
Javier López Pardo fb8bede8ea Add FakeDate object 2013-10-25 13:25:09 +02:00
Davis W. Frank 243ff80196 Fixing global leak for 'timer' 2013-10-24 17:17:05 -07:00
Sheel Choksi 6453ed656b Suites just have children instead of separating into specs/suites 2013-10-24 16:35:00 -07:00
Sheel Choksi a1a948b8df Remove completeCallback from suite as its unused 2013-10-24 16:34:34 -07:00
Sheel Choksi 7a4876ecfa Also move function to determine whether specs should catch exceptions into closure 2013-10-24 16:24:55 -07:00
Sheel Choksi d9ece1f14f Remove version/versionString and currentRunner
- Instead of version/versionString, jasmine.version should be sufficient
- currentRunner was exposing Jasmine's internal top level suite
2013-10-24 15:42:46 -07:00
Sheel Choksi f1613ce77c Move additional methods from Env prototype to env closure
- Users can no longer spelunk the spec tree from topSuite
- Users no longer have access to currentSuite/currentSpec
- Other miscellaneous (arguably less useful) methods have also been tucked
away into the closure, like suiteFactory
2013-10-24 15:28:01 -07:00
Sheel Choksi ab0b2b783c Move next spec/next suite ids into closure
No longer exposing these from the environment
2013-10-24 13:43:04 -07:00
Sheel Choksi a309117758 Remove TODO: should be easier to load polyfill for timeout functions as Jasmine does not get references to these functions until boot.js is loaded 2013-10-24 11:58:21 -07:00
Sheel Choksi 0c6e590a93 A spec without expectations is considered passing
- Specs are passing by default unless told otherwise
- Getting the result.status of a spec before the spec has run is now
  undefined instead of pending

[finishes #59422744]
2013-10-24 11:34:42 -07:00
Sheel Choksi 39d7ebf28e Remove an extra layer of wrapping for matchers/custom matchers
Helps reduce how nested custom matchers have to be for users as well as
Jasmine internal matchers

[#59161378]
2013-10-20 22:21:56 -07:00
Sheel Choksi 5f429fcb37 Re-enable CustomMatchersSpec and update for current version of custom matchers 2013-10-20 21:58:16 -07:00
Sheel Choksi fdb7df812c Improve error message when a spec doesn't call the async callback within the default time interval 2013-10-19 21:18:06 -07:00
Davis W. Frank 81299860aa Merge pull request #450 from slackersoft/manualClockUninstall
Env no longer automatically uninstalls the clock after each spec
2013-10-18 15:51:10 -07:00
slackersoft ca6fa6f711 Env no longer automatically uninstalls the clock after each spec
- Behaves more like how we want plugins to behave

[#58281436]
2013-10-16 18:39:03 -07:00
Davis W. Frank 8ca8197b4c Make exposure of addMatchers and addCustomEqualityTesters be on jasmine instead of inconsistent. 2013-10-10 11:32:21 -07:00
slackersoft 6641d64305 Make addCustomEqualityTester available on jasmine global
- User shouldn't have to `jasmine.getEnv()` to add one

[#54582648]
2013-10-06 11:32:38 -07:00
Gregg Van Hove and Tim Jarratt af4bfa8bc4 Env should use the "public" QueueRunner interface 2013-10-04 17:04:22 -07:00
slackersoft b5b77b318a Argument matcher for an array containing at least the specified entries 2013-10-03 18:21:47 -07:00
Gregg Van Hove and Tim Jarratt 7e071547f5 Custom matchers fail to behave as expected
If they return false, that should be respected.

Submitted via @tjgrathwell

[Finish #58184156]
close #434
2013-10-03 15:13:27 -07:00
Davis W. Frank 0c4113e167 Quick fix - Spec needs j$ at execute time 2013-10-02 22:45:33 -07:00
Gregg Van Hove and Tim Jarratt fc258b3d36 Make it easy to copy the title of failing specs
[finish #58121820]
2013-10-02 15:14:41 -07:00
Mike Stay ffa6138d75 Make getGlobal() work in strict mode
An update of https://github.com/metaweta/jasmine/commit/fb3e1acb09b4dbb9ccdbc15ce64b4a0e471f4541

ES5 strict mode does not promote an undefined 'this' to the global object.  The only way to get the global object in strict mode is to say 'this' while in the global scope.
2013-10-02 12:38:25 -06:00
Gregg Van Hove and Tim Jarratt cb8ba74937 Don't add periods to the full name of a spec
- Breaks links for spec filters
- Looks strange if users add their own

[fix #58043244] fix #427
2013-10-01 16:28:33 -07:00
Sheel Choksi da33c7823e Add missing var in front of j$ to avoid polluting global namespace
Users should only have 'jasmine' in global namespace, j$ should be
fully internal unless developing for jasmine

As brought up by Morten Maxild
2013-09-29 14:46:55 -07:00
Sheel Choksi efc384c6d6 Allow Env to take optional spec/suite ids when asked to execute 2013-09-17 19:55:49 -07:00
Sheel Choksi d60786a06c More clearly differentiate between spec and suite ids 2013-09-17 19:55:48 -07:00
Sheel Choksi 66010d01ec Give reporting symbols a little bit more height
Ensures they don't appear cut off when in the last row
2013-09-16 21:05:24 -07:00
Travis Grathwell 79a75f5bdb HTMLReporter symbols are inline-block rather than floated
On a very large test suite (8000 specs), a significant amount
of time is spent just drawing the spec dots. Some sort of
worse-than-linear artifact that summons itself only when you
have 8000 floated elements trying to hang out together.

This performance penalty is not seen with inline-block.

In Chrome 29:
  Floated dots: 16.795s
  Inline-block dots: 2.774s

Setting the dots to 'display: none;' takes about the same time
as the inline-block figure, so this is probably a low enough bound
(no need for chunked rendering or who knows what).
2013-09-10 19:46:51 -07:00