1
- const isCommonJS = typeof window == 'undefined' && typeof exports == 'object' ;
1
+ const isCommonJS = typeof window === 'undefined' && typeof exports = == 'object' ;
2
2
3
3
/**
4
4
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
@@ -616,7 +616,7 @@ if (isCommonJS) exports.xdescribe = xdescribe;
616
616
617
617
618
618
// Provide the XMLHttpRequest class for IE 5.x-6.x:
619
- jasmine . XmlHttpRequest = ( typeof XMLHttpRequest == 'undefined' ) ? function ( ) {
619
+ jasmine . XmlHttpRequest = ( typeof XMLHttpRequest === 'undefined' ) ? function ( ) {
620
620
function tryIt ( f ) {
621
621
try {
622
622
return f ( ) ;
@@ -625,18 +625,10 @@ jasmine.XmlHttpRequest = (typeof XMLHttpRequest == 'undefined') ? function () {
625
625
return null ;
626
626
}
627
627
628
- const xhr = tryIt ( ( ) => {
629
- return new ActiveXObject ( 'Msxml2.XMLHTTP.6.0' ) ;
630
- } ) ||
631
- tryIt ( ( ) => {
632
- return new ActiveXObject ( 'Msxml2.XMLHTTP.3.0' ) ;
633
- } ) ||
634
- tryIt ( ( ) => {
635
- return new ActiveXObject ( 'Msxml2.XMLHTTP' ) ;
636
- } ) ||
637
- tryIt ( ( ) => {
638
- return new ActiveXObject ( 'Microsoft.XMLHTTP' ) ;
639
- } ) ;
628
+ const xhr = tryIt ( ( ) => new ActiveXObject ( 'Msxml2.XMLHTTP.6.0' ) ) ||
629
+ tryIt ( ( ) => new ActiveXObject ( 'Msxml2.XMLHTTP.3.0' ) ) ||
630
+ tryIt ( ( ) => new ActiveXObject ( 'Msxml2.XMLHTTP' ) ) ||
631
+ tryIt ( ( ) => new ActiveXObject ( 'Microsoft.XMLHTTP' ) ) ;
640
632
641
633
if ( ! xhr ) throw new Error ( 'This browser does not support XMLHttpRequest.' ) ;
642
634
@@ -668,17 +660,15 @@ jasmine.util.formatException = function (e) {
668
660
let lineNumber ;
669
661
if ( e . line ) {
670
662
lineNumber = e . line ;
671
- }
672
- else if ( e . lineNumber ) {
663
+ } else if ( e . lineNumber ) {
673
664
lineNumber = e . lineNumber ;
674
665
}
675
666
676
667
let file ;
677
668
678
669
if ( e . sourceURL ) {
679
670
file = e . sourceURL ;
680
- }
681
- else if ( e . fileName ) {
671
+ } else if ( e . fileName ) {
682
672
file = e . fileName ;
683
673
}
684
674
@@ -879,20 +869,25 @@ jasmine.Env.prototype.xit = function (desc, func) {
879
869
} ;
880
870
881
871
jasmine . Env . prototype . compareRegExps_ = function ( a , b , mismatchKeys , mismatchValues ) {
882
- if ( a . source != b . source )
883
- { mismatchValues . push ( `expected pattern /${ b . source } / is not equal to the pattern /${ a . source } /` ) ; }
872
+ if ( a . source != b . source ) {
873
+ mismatchValues . push ( `expected pattern /${ b . source } / is not equal to the pattern /${ a . source } /` ) ;
874
+ }
884
875
885
- if ( a . ignoreCase != b . ignoreCase )
886
- { mismatchValues . push ( `expected modifier i was${ b . ignoreCase ? ' ' : ' not ' } set and does not equal the origin modifier` ) ; }
876
+ if ( a . ignoreCase != b . ignoreCase ) {
877
+ mismatchValues . push ( `expected modifier i was${ b . ignoreCase ? ' ' : ' not ' } set and does not equal the origin modifier` ) ;
878
+ }
887
879
888
- if ( a . global != b . global )
889
- { mismatchValues . push ( `expected modifier g was${ b . global ? ' ' : ' not ' } set and does not equal the origin modifier` ) ; }
880
+ if ( a . global != b . global ) {
881
+ mismatchValues . push ( `expected modifier g was${ b . global ? ' ' : ' not ' } set and does not equal the origin modifier` ) ;
882
+ }
890
883
891
- if ( a . multiline != b . multiline )
892
- { mismatchValues . push ( `expected modifier m was${ b . multiline ? ' ' : ' not ' } set and does not equal the origin modifier` ) ; }
884
+ if ( a . multiline != b . multiline ) {
885
+ mismatchValues . push ( `expected modifier m was${ b . multiline ? ' ' : ' not ' } set and does not equal the origin modifier` ) ;
886
+ }
893
887
894
- if ( a . sticky != b . sticky )
895
- { mismatchValues . push ( `expected modifier y was${ b . sticky ? ' ' : ' not ' } set and does not equal the origin modifier` ) ; }
888
+ if ( a . sticky != b . sticky ) {
889
+ mismatchValues . push ( `expected modifier y was${ b . sticky ? ' ' : ' not ' } set and does not equal the origin modifier` ) ;
890
+ }
896
891
897
892
return ( mismatchValues . length === 0 ) ;
898
893
} ;
@@ -1056,8 +1051,7 @@ jasmine.Block = function (env, func, spec) {
1056
1051
jasmine . Block . prototype . execute = function ( onComplete ) {
1057
1052
if ( ! jasmine . CATCH_EXCEPTIONS ) {
1058
1053
this . func . apply ( this . spec ) ;
1059
- }
1060
- else {
1054
+ } else {
1061
1055
try {
1062
1056
this . func . apply ( this . spec ) ;
1063
1057
} catch ( e ) {
@@ -1219,7 +1213,7 @@ jasmine.Matchers.matcherFn_ = function (matcherName, matcherFunction) {
1219
1213
message = message [ this . isNot ? 1 : 0 ] ;
1220
1214
}
1221
1215
} else {
1222
- const englishyPredicate = matcherName . replace ( / [ A - Z ] / g, ( s ) => { return ` ${ s . toLowerCase ( ) } ` ; } ) ;
1216
+ const englishyPredicate = matcherName . replace ( / [ A - Z ] / g, ( s ) => ` ${ s . toLowerCase ( ) } ` ) ;
1223
1217
message = `Expected ${ jasmine . pp ( this . actual ) } ${ this . isNot ? ' not ' : ' ' } ${ englishyPredicate } ` ;
1224
1218
if ( matcherArgs . length > 0 ) {
1225
1219
for ( let i = 0 ; i < matcherArgs . length ; i ++ ) {
@@ -1488,7 +1482,7 @@ jasmine.Matchers.prototype.toBeCloseTo = function (expected, precision) {
1488
1482
jasmine . Matchers . prototype . toThrow = function ( expected ) {
1489
1483
let result = false ;
1490
1484
let exception ;
1491
- if ( typeof this . actual != 'function' ) {
1485
+ if ( typeof this . actual !== 'function' ) {
1492
1486
throw new Error ( 'Actual is not a function' ) ;
1493
1487
}
1494
1488
try {
@@ -1519,19 +1513,19 @@ jasmine.Matchers.Any = function (expectedClass) {
1519
1513
1520
1514
jasmine . Matchers . Any . prototype . jasmineMatches = function ( other ) {
1521
1515
if ( this . expectedClass == String ) {
1522
- return typeof other == 'string' || other instanceof String ;
1516
+ return typeof other === 'string' || other instanceof String ;
1523
1517
}
1524
1518
1525
1519
if ( this . expectedClass == Number ) {
1526
- return typeof other == 'number' || other instanceof Number ;
1520
+ return typeof other === 'number' || other instanceof Number ;
1527
1521
}
1528
1522
1529
1523
if ( this . expectedClass == Function ) {
1530
- return typeof other == 'function' || other instanceof Function ;
1524
+ return typeof other === 'function' || other instanceof Function ;
1531
1525
}
1532
1526
1533
1527
if ( this . expectedClass == Object ) {
1534
- return typeof other == 'object' ;
1528
+ return typeof other === 'object' ;
1535
1529
}
1536
1530
1537
1531
return other instanceof this . expectedClass ;
@@ -1558,8 +1552,7 @@ jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function (other, mi
1558
1552
for ( const property in this . sample ) {
1559
1553
if ( ! hasKey ( other , property ) && hasKey ( this . sample , property ) ) {
1560
1554
mismatchKeys . push ( `expected has key '${ property } ', but missing from actual.` ) ;
1561
- }
1562
- else if ( ! env . equals_ ( this . sample [ property ] , other [ property ] , mismatchKeys , mismatchValues ) ) {
1555
+ } else if ( ! env . equals_ ( this . sample [ property ] , other [ property ] , mismatchKeys , mismatchValues ) ) {
1563
1556
mismatchValues . push ( `'${ property } ' was '${ other [ property ] ? jasmine . util . htmlEscape ( other [ property ] . toString ( ) ) : other [ property ] } ' in expected, but was '${ this . sample [ property ] ? jasmine . util . htmlEscape ( this . sample [ property ] . toString ( ) ) : this . sample [ property ] } ' in actual.` ) ;
1564
1557
}
1565
1558
}
@@ -1625,9 +1618,7 @@ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function (oldMillis, nowMi
1625
1618
}
1626
1619
1627
1620
if ( funcsToRun . length > 0 ) {
1628
- funcsToRun . sort ( ( a , b ) => {
1629
- return a . runAtMillis - b . runAtMillis ;
1630
- } ) ;
1621
+ funcsToRun . sort ( ( a , b ) => a . runAtMillis - b . runAtMillis ) ;
1631
1622
for ( let i = 0 ; i < funcsToRun . length ; ++ i ) {
1632
1623
try {
1633
1624
const funcToRun = funcsToRun [ i ] ;
@@ -1904,7 +1895,7 @@ jasmine.PrettyPrinter.prototype.format = function (value) {
1904
1895
this . emitScalar ( `Date(${ value } )` ) ;
1905
1896
} else if ( value . __Jasmine_been_here_before__ ) {
1906
1897
this . emitScalar ( `<circular reference: ${ jasmine . isArray_ ( value ) ? 'Array' : 'Object' } >` ) ;
1907
- } else if ( jasmine . isArray_ ( value ) || typeof value == 'object' ) {
1898
+ } else if ( jasmine . isArray_ ( value ) || typeof value === 'object' ) {
1908
1899
value . __Jasmine_been_here_before__ = true ;
1909
1900
if ( jasmine . isArray_ ( value ) ) {
1910
1901
this . emitArray ( value ) ;
@@ -2466,7 +2457,7 @@ jasmine.Suite.prototype.getFullName = function () {
2466
2457
jasmine . Suite . prototype . finish = function ( onComplete ) {
2467
2458
this . env . reporter . reportSuiteResults ( this ) ;
2468
2459
this . finished = true ;
2469
- if ( typeof ( onComplete ) == 'function' ) {
2460
+ if ( typeof ( onComplete ) === 'function' ) {
2470
2461
onComplete ( ) ;
2471
2462
}
2472
2463
} ;
0 commit comments