This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +39
-12
lines changed Expand file tree Collapse file tree 1 file changed +39
-12
lines changed Original file line number Diff line number Diff line change @@ -1587,22 +1587,49 @@ window.jstestdriver && (function(window) {
1587
1587
} ) ( window ) ;
1588
1588
1589
1589
1590
- window . jasmine && ( function ( window ) {
1590
+ ( window . jasmine || window . mocha ) && ( function ( window ) {
1591
1591
1592
- afterEach ( function ( ) {
1593
- var spec = getCurrentSpec ( ) ;
1594
- spec . $injector = null ;
1595
- spec . $modules = null ;
1596
- angular . mock . clearDataCache ( ) ;
1597
- } ) ;
1592
+ if ( window . jasmine ) {
1593
+ afterEach ( function ( ) {
1594
+ var spec = getCurrentSpec ( ) ;
1595
+ spec . $injector = null ;
1596
+ spec . $modules = null ;
1597
+ angular . mock . clearDataCache ( ) ;
1598
+ } ) ;
1599
+
1600
+ function getCurrentSpec ( ) {
1601
+ return jasmine . getEnv ( ) . currentSpec ;
1602
+ }
1598
1603
1599
- function getCurrentSpec ( ) {
1600
- return jasmine . getEnv ( ) . currentSpec ;
1604
+ function isSpecRunning ( ) {
1605
+ var spec = getCurrentSpec ( ) ;
1606
+ return spec && spec . queue . running ;
1607
+ }
1601
1608
}
1602
1609
1603
- function isSpecRunning ( ) {
1604
- var spec = getCurrentSpec ( ) ;
1605
- return spec && spec . queue . running ;
1610
+ if ( window . mocha ) {
1611
+ var currentSpec ;
1612
+
1613
+ beforeEach ( function ( ) {
1614
+ currentSpec = this ;
1615
+ } ) ;
1616
+
1617
+ afterEach ( function ( ) {
1618
+ var spec = getCurrentSpec ( ) ;
1619
+ this . $injector = null ;
1620
+ this . $modules = null ;
1621
+ angular . mock . clearDataCache ( ) ;
1622
+
1623
+ currentSpec = null ;
1624
+ } ) ;
1625
+
1626
+ function getCurrentSpec ( ) {
1627
+ return currentSpec ;
1628
+ }
1629
+
1630
+ function isSpecRunning ( ) {
1631
+ return getCurrentSpec ( ) ;
1632
+ }
1606
1633
}
1607
1634
1608
1635
/**
You can’t perform that action at this time.
0 commit comments