22
33const arrayProto = require ( "@sinonjs/commons" ) . prototypes . array ;
44const logger = require ( "@sinonjs/commons" ) . deprecated ;
5+ const wrap = logger . wrap ;
56const collectOwnMethods = require ( "./collect-own-methods" ) ;
67const getPropertyDescriptor = require ( "./util/core/get-property-descriptor" ) ;
78const isPropertyConfigurable = require ( "./util/core/is-property-configurable" ) ;
@@ -506,7 +507,7 @@ function Sandbox(opts = {}) {
506507 }
507508 } ;
508509
509- sandbox . useFakeServer = function useFakeServer ( ) {
510+ function useFakeServer ( ) {
510511 const proto = sandbox . serverPrototype || fakeServer ;
511512
512513 if ( ! proto || ! proto . create ) {
@@ -517,13 +518,23 @@ function Sandbox(opts = {}) {
517518 addToCollection ( sandbox . server ) ;
518519
519520 return sandbox . server ;
520- } ;
521+ }
522+
523+ sandbox . useFakeServer = wrap (
524+ useFakeServer ,
525+ "useFakeServer has been deprecated, and will be removed in the next major version" ,
526+ ) ;
521527
522- sandbox . useFakeXMLHttpRequest = function useFakeXMLHttpRequest ( ) {
528+ function useFakeXMLHttpRequest ( ) {
523529 const xhr = fakeXhr . useFakeXMLHttpRequest ( ) ;
524530 addToCollection ( xhr ) ;
525531 return xhr ;
526- } ;
532+ }
533+
534+ sandbox . useFakeXMLHttpRequest = wrap (
535+ useFakeXMLHttpRequest ,
536+ "useFakeXMLHttpRequest has been deprecated, and will be removed in the next major version" ,
537+ ) ;
527538
528539 sandbox . usingPromise = function usingPromise ( promiseLibrary ) {
529540 promiseLib = promiseLibrary ;
0 commit comments