@@ -31,6 +31,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131/* eslint-disable sort-keys */
3232
3333import { AssertionError } from 'assert' ;
34+ import chalk from 'chalk' ;
35+ import { formatExecError } from 'jest-message-util' ;
3436import { ErrorWithStack , isPromise } from 'jest-util' ;
3537import queueRunner , {
3638 Options as QueueRunnerOptions ,
@@ -424,14 +426,30 @@ export default function(j$: Jasmine) {
424426
425427 // TODO throw in Jest 25: declarationError = new Error
426428 if ( isPromise ( describeReturnValue ) ) {
427- console . warn (
428- 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' +
429- 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
429+ console . log (
430+ formatExecError (
431+ new Error (
432+ chalk . yellow (
433+ 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' +
434+ 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
435+ ) ,
436+ ) ,
437+ { rootDir : '' , testMatch : [ ] } ,
438+ { noStackTrace : false } ,
439+ ) ,
430440 ) ;
431441 } else if ( describeReturnValue !== undefined ) {
432- console . warn (
433- 'A "describe" callback must not return a value.\n' +
434- 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
442+ console . log (
443+ formatExecError (
444+ new Error (
445+ chalk . yellow (
446+ 'A "describe" callback must not return a value.\n' +
447+ 'Returning a value from "describe" will fail the test in a future version of Jest.' ,
448+ ) ,
449+ ) ,
450+ { rootDir : '' , testMatch : [ ] } ,
451+ { noStackTrace : false } ,
452+ ) ,
435453 ) ;
436454 }
437455
0 commit comments