allenhwkim / ngentest

Angular6+ Unit Test Generator For Components, Directive, Services, and Pipes
https://ngentest.github.io
MIT License
144 stars 60 forks source link

Error generating for close method #47

Closed caugustr closed 3 years ago

caugustr commented 3 years ago

When i have a component with this method, i receved this error, have some replace i can do to resolve?

 private closeLoadJava() {
        if (typeof (<any>window).closeLoad === "function") {
            (<any>window).closeLoad();
        }
    }
TypeError: target[firstKey] is not a function
at Function.merge (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\util.js:150:88)
at Function.merge (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\util.js:176:12)
at FuncTestGen.setPropsOrParams (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:279:14)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:161:12)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:90:12)
at C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:80:14
at Array.forEach (<anonymous>)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:79:17)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:104:12)
at C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\index.js:78:17
allenhwkim commented 3 years ago

I need to look at this carefully, It seems window is problematic. Will get back to you

allenhwkim commented 3 years ago

This was a bug. Fixed and released, ngentest 1.4.4 is released