Steve Gravrock
e56bd3918b
Added throwUnless and throwUnlessAsync
...
These are similar to `expect` and `expectAsync` except that they throw
exceptions rather than recording matcher failures as spec/suite failures.
They're intended to support using Jasmine matchers in testing-library's
`waitFor`, and also provide a way to integration-test custom matchers.
These funtions are not equivalent to `expect` and `expectAsync` and should
not be used in situations where you want a matcher failure to reliably fail
the spec. Whether that happens depends on the structure of the surrounding
code. In general, you should only use `throwUnless` when you expect
something (which could be your own code or library code like `waitFor`) to
catch the resulting exception.
Fixes #2003 .
Fixes #1980 .
2023-07-15 12:08:11 -07:00
Steve Gravrock
59600a1c29
Removed expect/expectAsync indirection through spec/suite
2023-07-15 12:08:11 -07:00
Steve Gravrock
c36a5cfd96
Parallel: Cleaner interface for reporter dispatching
...
This gets jasmine-npm out of having to deal with QueueRunner, GlobalErrors,
and ReportDispatcher directly.
2023-04-08 11:41:15 -07:00
Steve Gravrock
299fd1f770
Removed unnecessary TODO
2023-03-25 11:21:04 -07:00
Steve Gravrock
656427d328
Parallel: Disallow calls to Env#config from spec and helper files
...
Such configuration changes only affect one worker, which is almost certainly
not the intent.
2023-03-25 11:16:54 -07:00
Steve Gravrock
04fac300e8
Uninstall the global error at the end of env execution
...
jasmine-npm needs this so that it can do its own error handling during
globalTeardown.
2023-03-11 17:45:31 -08:00
Steve Gravrock
61505f4c59
Fixed post-merge test failures
2023-03-04 14:10:05 -08:00
Steve Gravrock
86eddb05b4
Merge remote-tracking branch 'origin/main' into 5.0
2023-03-04 14:06:43 -08:00
Steve Gravrock
6ad8d20694
Report the path/url of the file that the spec/suite was defined in
...
Fixes #1884
2023-02-15 21:39:21 -08:00
Steve Gravrock
af9a4114f4
Parallel: Improved error messages for top-level before/afterAll
2022-11-25 13:13:05 -08:00
Steve Gravrock
494e81f436
Document that stopOnSpecFailure is best-effort in parallel mode
2022-11-24 12:48:40 -08:00
Steve Gravrock
ed5e902106
Parallel: Don't allow reporters to be added or removed in worker processes
2022-10-22 09:56:52 -07:00
Steve Gravrock
47c64a86d5
Parallel: fail if randomization is disabled or a seed is specified
2022-10-12 20:08:42 -07:00
Steve Gravrock
bb497beeff
Parallel: throw if Env#topSuite is called
2022-10-11 20:16:36 -07:00
Steve Gravrock
e14d9c4be3
Parallel: forbid beforeAll/afterAll at the top level
...
Either running these once total or running them once per process
would be the wrong choice for a significant chunk of users, so do
neither. Later we'll add a new API for exactly-once setup and teardown
in parallel mode.
2022-10-11 20:10:02 -07:00
Steve Gravrock
89e0b35c53
Parallel: throw an error if fit/fdescribe are used in parallel mode
2022-10-11 19:35:59 -07:00
Steve Gravrock
1e7b68236b
Parallel: forbid beforeEach/afterEach at the top level of spec files
...
Each spec file is only loaded in a single worker, so top level
before/afterEach can't behave consistently.
beforeEach/afterEach are still supported in:
* Helper files
* describe() blocks
* At the top level of spec files in non-parallel mode
2022-10-11 19:25:39 -07:00
Steve Gravrock
6ada55ff77
Parallel: Fixed reporting of exceptions thrown by a describe
2022-09-18 12:10:34 -07:00
Steve Gravrock
735ce6f758
Merge remote-tracking branch 'origin/5.0' into parallel
2022-09-18 09:43:31 -07:00
Steve Gravrock
0690500a0d
Breaking change: Made Env#execute async
...
Errors related to invalid spec order are now reported via promise
rejection rather than synchronous throw.
2022-08-21 16:40:03 -07:00
Steve Gravrock
0bfbda720d
Breaking change: Env#execute no longer takes a callback
...
Use the returned promise instead.
2022-08-21 16:35:12 -07:00
Steve Gravrock
4fcdbd39fb
Breaking change: use addEventListener rather than setting window.onerror
...
* Generally simplifies error handling in browsers
* Makes Jasmine's own integration tests easier to debug
* Stack traces will be provided for more global errors
* ... but less error information will be provided in some browsers if the
error comes from a file:// URL (use `npx serve` or similar instead)
* Jasmine will no longer override existing onerror handlers in browsers
* Setting window.onerror will no longer override Jasmine's global error
handling (use jasmine.spyOnGlobalErrors instead)
2022-08-21 16:17:18 -07:00
Steve Gravrock
2e80ec0c22
Rm dead code for QueueRunner deprecations
2022-08-11 19:51:08 -07:00
Steve Gravrock
3a43871901
Reset the env state between parallel batches
2022-08-06 10:55:02 -07:00
Steve Gravrock
21f25972bb
Converted ReportDispatcher to promises
2022-07-01 17:25:22 -07:00
Steve Gravrock
6c56ebc984
Added jasmine.spyOnGlobalErrorsAsync
...
* Allows testing code that's expected to prodeuce global errors or
unhandled promise rejections
* Fixes #1843
* Fixes #1453
2022-06-30 18:09:56 -07:00
Steve Gravrock
d0a9931ae6
Separated reporter- and runable-specific queue runner configuration
2022-06-12 15:52:14 -07:00
Steve Gravrock
93c5f654d9
Extracted most suite-running code out of Env
2022-06-12 15:46:03 -07:00
Steve Gravrock
d8b65028a1
Pass queue runner factory to Spec#execute, not ctor
2022-06-12 12:34:46 -07:00
Steve Gravrock
d6cdc1841c
Extracted suite building out of Env
2022-06-12 09:49:01 -07:00
Steve Gravrock
72b39220e5
Runable, not runnable
2022-06-11 15:41:29 -07:00
Steve Gravrock
55dce7d119
Extracted runnable resource management out of Env
2022-06-11 15:28:37 -07:00
Steve Gravrock
135ff20123
Replaced uses of var with const/let
2022-06-09 20:00:23 -07:00
Steve Gravrock
4cc8437f79
Call buildExpectationResult directly from Suite and Spec
...
This removes quite a bit of indirection from result processing, at the
cost of making a few of the tests more awkward.
2022-06-01 10:18:23 -07:00
Steve Gravrock
bd368aceee
Replaced var with const and let in expectation related code
2022-06-01 09:22:03 -07:00
Steve Gravrock
bbb1b69b2e
More reliably report errors that occur late in the suite/spec lifecycle
...
Previously, an error that occurred after Jasmine started to report the
suiteDone or specDone event for the current runable would not be reliably
reported. Now such an error is reported on the nearest ancestor suite whose
suiteDone event has not yet been reported.
2022-05-28 18:10:55 -07:00
Steve Gravrock
9e10743a1c
Include the name of the suite in the empty suite error message
2022-01-17 15:08:56 -08:00
Steve Gravrock
c431590d65
Fixed reporting of suites that are skipped due to a beforeAll failure
2021-12-20 13:39:24 -08:00
Steve Gravrock
24408a16ed
Removed initialization of unused Promise config property
2021-12-15 20:34:00 -08:00
Steve Gravrock
30b93ccdbb
Updated jsdocs for Env#execute
2021-12-11 15:53:25 -08:00
Steve Gravrock
0b1385c3d3
Report start and end events for specs/suites that are skipped due to a beforeAll error
...
This is noisier, but it maintains compatibility with reporters that assume
(quite reasonably) that all specs and suites are either filtered out or
reported.
2021-12-11 12:34:23 -08:00
Steve Gravrock
f1cf6ee419
Resolve the execute() promise to the entire JasmineDoneInfo
...
This matches jasmine-npm.
2021-12-09 18:18:36 -08:00
Steve Gravrock
40fac8b6a2
Renamed the trace feature to debugLog[s]
...
"trace" was ambiguous and could easily be understood to have something
to do with stack traces.
2021-12-02 14:46:56 -08:00
Steve Gravrock
d739c23401
Resolve the promise returned by Env#execute to the overall status
2021-12-02 12:40:14 -08:00
Steve Gravrock
871ba99a30
Allow custom spy strategies to be inherited like other runnable resources
2021-11-17 12:50:16 -08:00
Steve Gravrock
2a049015b0
Use custom equality testers in Spy#withArgs
...
Fixes #1836 .
2021-11-15 18:55:09 -08:00
Steve Gravrock
8e74529631
Merge branch '3.99' into 4.0
2021-10-15 10:37:51 -07:00
Steve Gravrock
ab34f272da
Merge branch 'main' into 3.99
2021-10-15 10:29:50 -07:00
Andre Willomitzer
bb9175cb66
added additional error msg for delayedExpectation
...
added matching error msgs in jasmine objects
Ran prettier.
removed indenting, formatted column length < 80
2021-10-12 13:17:24 -04:00
Steve Gravrock
53b1cd37b6
Merge branch '3.99' into 4.0
2021-10-07 10:56:41 -07:00