@nevware21/tripwire - v0.1.2
    Preparing search index...

    Function addAssertInstFuncDef

    • Adds a single scope function or property to the assert (instance) prototype, which will extend (or replace) IAssertInst definition, you can then use the IExtendedAssertInst type to cast the instance object returned via the expect function as it will contain the newly added function or property.

      Note: This function/property is NOT added to the assert or the instance returned via the createAssert only the IAssertInst object returned via the expect function.

      Type Parameters

      • T

      Parameters

      Returns void

      addAssertInstFuncDef("myFunc", {
      scopeFn: function myFunc(this: IAssertScope) {
      // Do something
      }
      });

      addAssertInstFuncDef("myProp", {
      propFn: function myProp(this: IAssertScope) {
      // Do something when the property is accessed
      this.context.eval(this.context.value === "darkness", "expected {value} to be 'darkness'");
      }
      });

      interface MyExpect extends IAssertInst {
      myFunc(): void;
      myProp: void;
      }

      let inst = expect("hello");
      let extInst = inst as IExtendedAssertInst<MyExpect>;
      extInst.myFunc();
      extInst.myProp; // throws AssertionFailure

      0.1.0