(driver as any)[commandName] = function()()

in spec/command_tests/helpers.ts [63:74]


        (driver as any)[commandName] = function() {
          let oldCount = spy.calls.count();
          return oldFun.apply(this, arguments).then((result: any) => {
            expect(spy.calls.count()).toBe(oldCount + 1);
            let args = spy.calls.mostRecent().args;
            return {
              result: result,
              session: args[0],
              params: args[1]
            };
          });
        };