File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 1
1
export function fail ( _ , message ) {
2
+ this . dontThrow ( ) ;
2
3
return {
3
4
pass : false ,
4
5
message : ( ) => ( message ? message : 'fails by .fail() assertion' ) ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,11 +3,18 @@ import * as matcher from 'src/matchers/fail';
3
3
expect . extend ( matcher ) ;
4
4
5
5
describe ( '.fail' , ( ) => {
6
- test ( 'fails without message' , ( ) => {
7
- expect ( ( ) => expect ( ) . fail ( ) ) . toThrowErrorMatchingSnapshot ( ) ;
6
+ xtest ( 'fails without message' , ( ) => {
7
+ expect ( ) . fail ( ) ; // This should fail!
8
8
} ) ;
9
- test ( 'fails with message' , ( ) => {
10
- expect ( ( ) => expect ( ) . fail ( "This shouldn't fail!" ) ) . toThrowErrorMatchingSnapshot ( ) ;
9
+ xtest ( 'fails with message' , ( ) => {
10
+ expect ( ) . fail ( 'This should fail!' ) ;
11
+ } ) ;
12
+ xtest ( 'fails when invoked in a try/catch' , ( ) => {
13
+ try {
14
+ expect ( ) . fail ( ) ;
15
+ } catch ( error ) {
16
+ expect ( 'this assertion' ) . toBe ( 'not checked' ) ;
17
+ }
11
18
} ) ;
12
19
} ) ;
13
20
@@ -16,6 +23,6 @@ describe('.not.fail', () => {
16
23
expect ( ) . not . fail ( ) ;
17
24
} ) ;
18
25
test ( 'does not fail with message' , ( ) => {
19
- expect ( ) . not . fail ( 'this should fail!' ) ;
26
+ expect ( ) . not . fail ( 'this should not fail!' ) ;
20
27
} ) ;
21
28
} ) ;
You can’t perform that action at this time.
0 commit comments