2
2
3
3
const arrayProto = require ( "@sinonjs/commons" ) . prototypes . array ;
4
4
const logger = require ( "@sinonjs/commons" ) . deprecated ;
5
+ const wrap = logger . wrap ;
5
6
const collectOwnMethods = require ( "./collect-own-methods" ) ;
6
7
const getPropertyDescriptor = require ( "./util/core/get-property-descriptor" ) ;
7
8
const isPropertyConfigurable = require ( "./util/core/is-property-configurable" ) ;
@@ -506,7 +507,7 @@ function Sandbox(opts = {}) {
506
507
}
507
508
} ;
508
509
509
- sandbox . useFakeServer = function useFakeServer ( ) {
510
+ function useFakeServer ( ) {
510
511
const proto = sandbox . serverPrototype || fakeServer ;
511
512
512
513
if ( ! proto || ! proto . create ) {
@@ -517,13 +518,23 @@ function Sandbox(opts = {}) {
517
518
addToCollection ( sandbox . server ) ;
518
519
519
520
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
+ ) ;
521
527
522
- sandbox . useFakeXMLHttpRequest = function useFakeXMLHttpRequest ( ) {
528
+ function useFakeXMLHttpRequest ( ) {
523
529
const xhr = fakeXhr . useFakeXMLHttpRequest ( ) ;
524
530
addToCollection ( xhr ) ;
525
531
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
+ ) ;
527
538
528
539
sandbox . usingPromise = function usingPromise ( promiseLibrary ) {
529
540
promiseLib = promiseLibrary ;
0 commit comments