File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ setupFn = -> null
2
+ window .setup = (fn ) ->
3
+ setupFn = fn
4
+ window .moreSetup = (fn ) ->
5
+ origSetup = setupFn
6
+ setup ->
7
+ origSetup .call (this )
8
+ fn .call (this )
9
+ window .clearSetup = ->
10
+ setup -> null
11
+
12
+ originalModule = window .module
13
+ window .module = (description ) ->
14
+ clearSetup ()
15
+ originalModule (description)
16
+
17
+ originalTest = window .test
18
+ window .test = (description , testFn ) ->
19
+ setupSnapshot = setupFn
20
+ originalTest description, ->
21
+ context = {}
22
+ setupSnapshot .call (context)
23
+ testFn .call (context)
Original file line number Diff line number Diff line change
1
+ ( function ( ) {
2
+ var originalModule , originalTest , setupFn ;
3
+ setupFn = function ( ) {
4
+ return null ;
5
+ } ;
6
+ window . setup = function ( fn ) {
7
+ return ( setupFn = fn ) ;
8
+ } ;
9
+ window . moreSetup = function ( fn ) {
10
+ var origSetup ;
11
+ origSetup = setupFn ;
12
+ return setup ( function ( ) {
13
+ origSetup . call ( this ) ;
14
+ return fn . call ( this ) ;
15
+ } ) ;
16
+ } ;
17
+ window . clearSetup = function ( ) {
18
+ return setup ( function ( ) {
19
+ return null ;
20
+ } ) ;
21
+ } ;
22
+ originalModule = window . module ;
23
+ window . module = function ( description ) {
24
+ clearSetup ( ) ;
25
+ return originalModule ( description ) ;
26
+ } ;
27
+ originalTest = window . test ;
28
+ window . test = function ( description , testFn ) {
29
+ var setupSnapshot ;
30
+ setupSnapshot = setupFn ;
31
+ return originalTest ( description , function ( ) {
32
+ var context ;
33
+ context = { } ;
34
+ setupSnapshot . call ( context ) ;
35
+ return testFn . call ( context ) ;
36
+ } ) ;
37
+ } ;
38
+ } ) . call ( this ) ;
You can’t perform that action at this time.
0 commit comments