File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed
jest-jasmine2/src/jasmine Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ it('warns if describe returns a Promise', () => {
1414
1515 expect ( result . status ) . toBe ( 0 ) ;
1616 expect ( result . stdout ) . toMatch ( / T e s t s m u s t b e d e f i n e d s y n c h r o n o u s l y / ) ;
17+ expect ( result . stdout ) . toMatch ( / a t O b j e c t .d e s c r i b e / ) ;
1718} ) ;
1819
1920it ( 'warns if describe returns something' , ( ) => {
@@ -23,4 +24,5 @@ it('warns if describe returns something', () => {
2324
2425 expect ( result . status ) . toBe ( 0 ) ;
2526 expect ( result . stdout ) . toMatch ( / " d e s c r i b e " c a l l b a c k m u s t n o t r e t u r n a v a l u e / ) ;
27+ expect ( result . stdout ) . toMatch ( / a t O b j e c t .d e s c r i b e / ) ;
2628} ) ;
Original file line number Diff line number Diff line change @@ -68,13 +68,17 @@ const _dispatchDescribe = (
6868 // TODO throw in Jest 25
6969 if ( isPromise ( describeReturn ) ) {
7070 console . warn (
71- 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' +
72- 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
71+ new ErrorWithStack (
72+ 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' +
73+ 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
74+ ) ,
7375 ) ;
7476 } else if ( describeReturn !== undefined ) {
7577 console . warn (
76- 'A "describe" callback must not return a value.\n' +
77- 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
78+ new ErrorWithStack (
79+ 'A "describe" callback must not return a value.\n' +
80+ 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
81+ ) ,
7882 ) ;
7983 }
8084
Original file line number Diff line number Diff line change @@ -379,13 +379,17 @@ export default function(j$) {
379379 // TODO throw in Jest 25: declarationError = new Error
380380 if ( isPromise ( describeReturnValue ) ) {
381381 console . warn (
382- 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' +
383- 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
382+ new ErrorWithStack (
383+ 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' +
384+ 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
385+ ) ,
384386 ) ;
385387 } else if ( describeReturnValue !== undefined ) {
386388 console . warn (
387- 'A "describe" callback must not return a value.\n' +
388- 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
389+ new ErrorWithStack (
390+ 'A "describe" callback must not return a value.\n' +
391+ 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
392+ ) ,
389393 ) ;
390394 }
391395
You can’t perform that action at this time.
0 commit comments