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 11export function fail ( _ , message ) {
2+ this . dontThrow ( ) ;
23 return {
34 pass : false ,
45 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';
33expect . extend ( matcher ) ;
44
55describe ( '.fail' , ( ) => {
6- test ( 'fails without message' , ( ) => {
7- expect ( ( ) => expect ( ) . fail ( ) ) . toThrowErrorMatchingSnapshot ( ) ;
6+ xtest ( 'fails without message' , ( ) => {
7+ expect ( ) . fail ( ) ; // This should fail!
88 } ) ;
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+ }
1118 } ) ;
1219} ) ;
1320
@@ -16,6 +23,6 @@ describe('.not.fail', () => {
1623 expect ( ) . not . fail ( ) ;
1724 } ) ;
1825 test ( 'does not fail with message' , ( ) => {
19- expect ( ) . not . fail ( 'this should fail!' ) ;
26+ expect ( ) . not . fail ( 'this should not fail!' ) ;
2027 } ) ;
2128} ) ;
You can’t perform that action at this time.
0 commit comments