<commit_before>
         
   SINON  
         



ALTERNATIVES ==>                  #  - sinon (prefer): lots of features
                                  #  - testdouble.js: a little fewer features
                                  #  - jest mocks: Jest-specific
                                  #  - jasmine-spies: Jasmine-specific
                                  #  - chai-spies: Chai-specific, less features

VERSION ==>                       #8.0.4
                                  #Node.js or browser
                                  #Provides spies, function stubs and related assertions.
                                  #Also links to Lolex and Nise for: mocks timers, mocks client-side responses (XHR)


                                             /=+===============================+=\
                                            /  :                               :  \
                                            )==:             SPIES             :==(
                                            \  :_______________________________:  /
                                             \=+===============================+=/


SINON.spy([FUNC])->SPYFUNC        #Creates a SPYFUNC
                                  #FUNC is original function (def: empty).
SINON.spy(OBJ[, 'FUNC'][,STR_ARR])#Same but with OBJ.FUNC (def: all methods), and SPYFUNC is assigned to OBJ.FUNC
                                  #STR_ARR can be 'get|set', which will set SPYFUNC.get|set SPYFUNC2

SPYFUNC.resetHistory()            #Erase previous calls. Does not transform back.
SINON.restoreObject(SPYFUNC)      #Removes spying

SPYFUNC.withArgs(SVAL...)->SPYFUNC#Only for calls made with arguments SVAL...

SPYFUNC.callCount                 #Number of times it has been fired
SPYFUNC.[not]called               #callCount !== 0
SPYFUNC.calledOnce|Twice|Thrice   #callCount === 1|2|3

SPYFUNC.calledWith(SVAL...)->BOOL #Fired with at least those arguments.
SPYFUNC.calledWithMatch(VAL...)
 ->BOOL                           #Fired with at least those arguments, automatically wrapped as SINON.match(VAL)
SPYFUNC.calledWithExactly(SVAL...)
 ->BOOL                           #Fired with exactly those arguments
SPYFUNC.returned(SVAL)->BOOL      #Returned VAL (deep comparison).
SPYFUNC.calledOn(OBJ|SVAL)->BOOL  #Fired with OBJ as `this`
SPYFUNC.calledWithNew()->BOOL     #Fired as new SPYFUNC
SPYFUNC.threw([VAL|STR])->BOOL    #Threw error. STR is ERROR.type.
SPYFUNC.
 called[Immediately]Before|After  #First call of SPYFUNC before|after SPYFUNC2
 (SPYFUNC2)->BOOL                 #If "Immediately", no other SPYFUNC3 in-between.

AT LEAST ONCE ==>                 #All the above are "at least once"
SPYFUNC.alwaysCalledWith*|
 Returned|CalledOn|CalledWithNew|
 Threw(...)                       #Same but "always"
SPYFUNC.neverCalledWith*(...)     #Same but "never"
SPYFUNC.calledOnceWith*(...)      #Same but "exactly once"

SPYFUNC.getCalls()->SPYCALL_ARR   #
SPYFUNC.getCall(NUM)->SPYCALL     #
SPYFNC.first|second|third|lastCall#Same as SPYFUNC.getCall(1|2|3|last)
SPYCALL.*called|returned|threw*   #Same as SPYFUNC.*(...)
 (...)                            #Cannot use always|never|Once

SPYCALL.args                      #VAL_ARR
SPYCALL.lastArg                   #VAL
SPYCALL.callback                  #lastArg if FUNC, undefined otherwise
SPYCALL.returnValue               #Return VAL
SPYCALL.thisValue                 #this OBJ
SPYCALL.exception                 #Exception thrown VAL (or undefined)
SPYFUNC.thisValues|args|
exceptions|returnValues           #Same but as ARR

SPYFUNC.printf(STR[, VAL...])     #Printf using formatting STR with:
                                  #  - "%n": 'FUNC'
                                  #  - "%c": SPYFUNC.callCount in word
                                  #  - "%C": 'FUNC(ARGS) at FILE:LINE'
                                  #  - "%D": 'ARGS'
                                  #  - "%t": `this`
                                  #  - "%NUM": VAL
                                  #  - "%*": all VAL...
<commit_msg>no commit message<commit_after>
         
   SINON  
         



ALTERNATIVES ==>                  #  - sinon (prefer): lots of features
                                  #  - testdouble.js: a little fewer features
                                  #  - jest mocks: Jest-specific
                                  #  - jasmine-spies: Jasmine-specific
                                  #  - chai-spies: Chai-specific, less features

VERSION ==>                       #8.1.0
                                  #Node.js or browser
                                  #Provides spies, function stubs and related assertions.
                                  #Also links to Lolex and Nise for: mocks timers, mocks client-side responses (XHR)


                                             /=+===============================+=\
                                            /  :                               :  \
                                            )==:             SPIES             :==(
                                            \  :_______________________________:  /
                                             \=+===============================+=/


SINON.spy([FUNC])->SPYFUNC        #Creates a SPYFUNC
                                  #FUNC is original function (def: empty).
SINON.spy(OBJ[, 'FUNC'][,STR_ARR])#Same but with OBJ.FUNC (def: all methods), and SPYFUNC is assigned to OBJ.FUNC
                                  #STR_ARR can be 'get|set', which will set SPYFUNC.get|set SPYFUNC2

SPYFUNC.resetHistory()            #Erase previous calls. Does not transform back.
SINON.restoreObject(SPYFUNC)      #Removes spying

SPYFUNC.withArgs(SVAL...)->SPYFUNC#Only for calls made with arguments SVAL...

SPYFUNC.callCount                 #Number of times it has been fired
SPYFUNC.[not]called               #callCount !== 0
SPYFUNC.calledOnce|Twice|Thrice   #callCount === 1|2|3

SPYFUNC.calledWith(SVAL...)->BOOL #Fired with at least those arguments.
SPYFUNC.calledWithMatch(VAL...)
 ->BOOL                           #Fired with at least those arguments, automatically wrapped as SINON.match(VAL)
SPYFUNC.calledWithExactly(SVAL...)
 ->BOOL                           #Fired with exactly those arguments
SPYFUNC.returned(SVAL)->BOOL      #Returned VAL (deep comparison).
SPYFUNC.calledOn(OBJ|SVAL)->BOOL  #Fired with OBJ as `this`
SPYFUNC.calledWithNew()->BOOL     #Fired as new SPYFUNC
SPYFUNC.threw([VAL|STR])->BOOL    #Threw error. STR is ERROR.type.
SPYFUNC.
 called[Immediately]Before|After  #First call of SPYFUNC before|after SPYFUNC2
 (SPYFUNC2)->BOOL                 #If "Immediately", no other SPYFUNC3 in-between.

AT LEAST ONCE ==>                 #All the above are "at least once"
SPYFUNC.alwaysCalledWith*|
 Returned|CalledOn|CalledWithNew|
 Threw(...)                       #Same but "always"
SPYFUNC.neverCalledWith*(...)     #Same but "never"
SPYFUNC.calledOnceWith*(...)      #Same but "exactly once"

SPYFUNC.getCalls()->SPYCALL_ARR   #
SPYFUNC.getCall(NUM|-NUM)->SPYCALL#
SPYFNC.first|second|third|lastCall#Same as SPYFUNC.getCall(1|2|3|-1)
SPYCALL.*called|returned|threw*   #Same as SPYFUNC.*(...)
 (...)                            #Cannot use always|never|Once

SPYCALL.args                      #VAL_ARR
SPYCALL.lastArg                   #VAL
SPYCALL.callback                  #lastArg if FUNC, undefined otherwise
SPYCALL.returnValue               #Return VAL
SPYCALL.thisValue                 #this OBJ
SPYCALL.exception                 #Exception thrown VAL (or undefined)
SPYFUNC.thisValues|args|
exceptions|returnValues           #Same but as ARR

SPYFUNC.printf(STR[, VAL...])     #Printf using formatting STR with:
                                  #  - "%n": 'FUNC'
                                  #  - "%c": SPYFUNC.callCount in word
                                  #  - "%C": 'FUNC(ARGS) at FILE:LINE'
                                  #  - "%D": 'ARGS'
                                  #  - "%t": `this`
                                  #  - "%NUM": VAL
                                  #  - "%*": all VAL...

{'fraction_non_alphanumeric': 0.18645029505220154, 'fraction_numerical': 0.0032909668633681346, 'mean_word_length': 1.5997050147492626, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 56, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '258695', 'n_tokens_mistral': 4334, 'n_tokens_neox': 4245, 'n_words': 548}