Commit Graph

53 Commits

Author SHA1 Message Date
Steve Gravrock 168ff0a751 Move private APIs to private namespace
Fixes #2078
2025-09-27 13:21:09 -07:00
Steve Gravrock 8d99f27be8 Throw an Error rather than a string when createSpyObj is called incorectly 2025-08-23 08:19:11 -07:00
Steve Gravrock 5ff7e7f9a1 Updated to eslint 9
This isn't officially compatible with the oldest version of Node that
Jasmine supports, but it works. If it stops working, we can always disable
linting in CI builds on older Node versions.
2025-04-07 21:39:58 -07:00
Steve Gravrock 1166d10e43 Use const/let in specs, not var 2022-04-16 13:41:44 -07:00
Steve Gravrock 482dc883eb Check for unused vars and params in specs 2022-04-16 10:58:25 -07:00
Steve Gravrock 2a049015b0 Use custom equality testers in Spy#withArgs
Fixes #1836.
2021-11-15 18:55:09 -08:00
Steve Gravrock d61800c5c8 Removed support for custom promise libraries
All supported platforms now provide promises, so there's no longer a need
for Jasmine to be able to create them via a user-provided library. Jasmine
can still consume non-native promises but will always use the built-in
Promise object to create promises.

[#179078103]
2021-08-30 19:07:26 -07:00
Steve Gravrock a63b0b0368 Merge branch '3.99' into 4.0 2021-08-30 18:44:32 -07:00
Steve Gravrock 4e96514634 Deprecated the Promise config setting
4.0 will only support environments that have native promises, so there will
no longer be a need for a user-supplied promise library
2021-08-07 12:04:14 -07:00
Steve Gravrock fe0a83ba87 Removed support for Internet Explorer 2021-07-23 21:46:15 -07:00
Ikko Ashimine 4e1f36cbb0 Fix typo in SpySpec.js
ommitted -> omitted
2021-06-12 10:00:36 +09:00
DCtheTall d5d5d1965f Have properties added by createSpyObj() be enumerable. 2020-10-02 13:49:34 -04:00
Steve Gravrock 7f392d188e Don't leak global error handlers between Jasmine's own tests 2020-01-20 10:18:29 -08:00
Elliot Nelson 65e6df55ee Linting fixes 2019-06-20 07:34:31 -04:00
Elliot Nelson 45475f6d1e Allow users to pass property names to createSpyObj 2019-06-20 07:33:10 -04:00
Gregg Van Hove 8af669677a Cleanup spy promise strategies to be more consistent with Jasmine at large
- Rename `resolveWith` to `resolveTo` to match `toBeResolvedTo`
- No longer wrap non-Errors in `rejectWith`

- Fixes #1715
2019-05-23 17:29:12 -07:00
Gregg Van Hove b4cbe9850f add prettier and eslint 2019-05-21 18:23:48 -07:00
Elliot Nelson b2fb92eedd Promise-based strategies are now named resolveWith and rejectWith 2019-05-09 06:12:06 -04:00
Elliot Nelson 4731b4ee4d Keep all Promise implementation details internal 2019-05-08 09:13:41 -04:00
Felix Rilling 63f900287c Fixed typo "receieved" to "received", Adapted test. 2019-03-10 10:59:56 +01:00
Gregg Van Hove f7097281c9 IE doesn't support .name on a function 2018-05-03 17:34:15 -07:00
Fangzhou Li fbcdbf5ab1 Allow omitting the name argument: createSpy(func) 2018-04-29 06:07:22 +08:00
Steve Gravrock 6f119c4e5a Moved createSpy to env so it can be stateful 2018-01-09 10:16:02 -08:00
Steve Gravrock 298b5ba127 Moved createSpyObj to env so it can be stateful 2018-01-09 09:53:45 -08:00
Steve Gravrock 16e07a0e99 Add the ability to specify the strategy to use for a spy based on which parameters are passed
[Finishes #92260826]
2018-01-03 08:49:34 -08:00
Gregg Van Hove 21655a82c9 Use prototype for spy strategy for better memory management
- Also convert `identity` to a property from a method
2017-11-30 17:30:20 -08:00
Pivotal 369e8cc08b Merge branch 'mockMethodsShortcut' of https://github.com/mbildner/jasmine into mbildner-mockMethodsShortcut
- Merges #1101 from @mbildner
2016-10-17 15:53:05 -07:00
Gregg Van Hove d85d6dd4b8 Now that it's valid syntax, make the specs work right with for 2016-09-28 12:19:18 -07:00
Gregg Van Hove ff85714b24 syntax for a for loop is different than forEach 2016-09-28 11:52:18 -07:00
Gregg Van Hove 0d1a9a72d9 Fix spy arity stuff to work in IE8 2016-09-28 11:49:07 -07:00
Pivotal 7a62969a14 createSpyObj may use object for method->response shorthand
examples:

```JavaScript
var mySpy = jasmine.createSpyObj("mySpy", { getAge: 55, getLanguage: "JavaScrizzle" });

var age = mySpy.getAge();

expect(age).toEqual(55);
expect(mySpy.getAge).toHaveBeenCalled();
```

Also does:

Add "isObject_" method to utils to make it easier for "createSpy" to support an array or object of stubs
2016-04-25 17:10:22 -04:00
Andrzej Kopeć 90dea9ab38 Now spies preserve original function arity 2016-02-25 21:43:18 +01:00
Gregg Van Hove 79206ccff5 Rename j$ to jasmineUnderTest for specs
- Clarifies what it is for when writing tests
- No longer named the same as the `jasmine` that is injected into live
  code
2015-12-03 17:23:32 -08:00
Gregg Van Hove 3140d5fb95 Allow createSpyObj to be called with just an array of method names
[Finish #50757607] #321
2015-01-12 15:16:50 -08:00
pimterry b1d4ab09af Add tests for call return value tracking 2013-12-08 13:40:25 +00:00
pimterry b2e8de7bcd Mock callTracker in spy tests for better test isolation 2013-12-07 20:43:38 +00:00
pimterry 1d98a23b14 Add tests for call tracking in createSpy 2013-12-07 20:27:08 +00:00
Josh Soref c7e3ca6c8a Spelling: Fix spelling errors
* equal
* existence
* expectation
* expected
* intend
* message
* report
* singular
2013-10-30 20:12:05 -04:00
Gregg Van Hove and Tim Jarratt 1c19b8e38a Move spec files back out of spec/javascripts
- Jasmine gem allows us to specify a path to jasmine.yml via ENV

[finish #58126010]
2013-10-02 16:32:35 -07:00
Gregg Van Hove and Rajan Agaskar 5017d1a4f1 Make rake jasmine:ci run specs correctly.
- Will replace rake core_specs.
- Remove obsolete dependencies & files -- most of these were for build tasks we
  are no longer using. Notably, rspec and spec_helper were deleted.
2013-09-25 10:11:02 -07:00
Colin O'Byrne and JR Boyens 97ce396008 Build distribution; fix test in FF 2013-07-24 14:41:55 -07:00
Colin O'Byrne and JR Boyens 051f3499ec Revert "[Finishes #45476285] Add timeout support to async tests"
This reverts commit 8f5d0beb8c.

Async timeout support is just not ready for prime time.
2013-07-24 14:39:06 -07:00
Colin O'Byrne and JR Boyens 8f5d0beb8c [Finishes #45476285] Add timeout support to async tests 2013-07-23 17:07:02 -07:00
Colin O'Byrne and JR Boyens 9609aba25f [Finishes #52959947] Warn user about spy conflicts; Refactor spy tests to more reflect responsibilities and removed duplicate tests 2013-07-23 17:00:30 -07:00
Colin O'Byrne and JR Boyens 30aec66ce5 [Finishes #14177231] copy properties onto spy 2013-07-22 14:54:43 -07:00
Davis W. Frank & Sheel Choksi 3847557bbc Squashed spy refactor and new spy syntax
Jasmine spies now have a 'and' property which allows the user to
change the spy's execution strategy-- such as '.and.callReturn(4)'
and a 'calls' property which allows inspection of the calls a spy
has received.

* This is a breaking change *

There is a CallTracker that keeps track of all calls and arguments
and a SpyStrategy which determines what the spy should do when it
is called.
2013-07-22 14:29:52 -07:00
Davis W. Frank and Sheel Choksi dcf7a0867e Test asynchronous parts of Jasmine asynchronously 2013-07-02 16:37:38 -07:00
Davis W. Frank 3271dc8838 Last commit did not include self-test with Any and ObjectContaining in separate files. Fixed. 2013-06-02 22:16:30 -07:00
Davis W. Frank aca43bd3a3 Squashed commit of work to make Jasmine a collection of isolated modules. Note now that in our test suite, "jasmine" now always refers to the build jasmine loaded from jasmine.js and "j$" always refers to the code in the src directories.
Also, dev_boot.js is now a copy of boot.js and has additional changes to load jasmine the second time, into the j$ reference.
2013-05-28 14:09:20 -07:00
Davis W. Frank & Rajan Agaskar a1011e7748 Rewrite Spec & allow Jasmine to be namespaced
- THere seems to be a performance regression. Large test suites may
  throw
- Regressions: Mock Clock won't install correctly, async specs are
  temporarily not supported.
- Async spec runs/waits interface is gone. Blocks are gone.
- Move most global usage into jasmine.Env constructor.
- Remove optional 'Jasmine running' from HtmlReporter -- caused
  NS_FACTORY_ERROR in firefox when tested
2012-12-06 09:10:24 -08:00