Closed martinduo closed 3 years ago
Can you please run npx jest
command in the repo's root to check if it's failing or passing?
If the npx jest
run is passing, can you please:
src/_modulePlanObject.test.js
looks like? You may obviously remove any sensitive data from the file, and just leave the imports and the failing test and the describe/it
structure around it.I fixed it. Thanks to your suggestion, I found that npx jest failed also. And that lead to further digging and I found that in just one of my first written tests, _modulePlanObject.test.js, I had delayed the call to addCrumbsPlusHelpers() to allow me to specifically test the result of that call later. All other test files included that call to addCrumbsPlusHelpers() in their initialization.
So that left the functions missing for any other call to moduleObjectRoutines() that expected the functions to be present. That case was not present until I added the usage of theArray() there later in the course of writing more tests, and then Wallaby made that call as part of its own initializations (I think).
I never thought to try npx jest, especially after I ran my VSCode debug jest script and stepped through the code and found the function present. That was successful probably due to a different sequence of preliminary actions that added the functions. (My own "timing problem").
Again thanks for your help. As a retired developer working at home (NYC), being able to walk to another programmer to ask about a coding problem is what I miss most. That interaction always seemed to lead to finding a fix. You supplied that help. Overnight too! Thanks.
On Mon, Nov 2, 2020 at 10:24 PM Artem Govorov notifications@github.com wrote:
Can you please run npx jest command in the repo's root to check if it's failing or passing?
If the npx jest run is passing, can you please:
- share show your src/_modulePlanObject.test.js looks like? You may obviously remove any sensitive data from the file, and just leave the imports and the failing test and the describe/it structure around it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wallabyjs/public/issues/2554#issuecomment-720883946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGWZ3A6RI3KFKNX74LIGPDSN5ZXBANCNFSM4TIGZLYQ .
Awesome, thanks for the update!
Issue description or question
I think I've found a bug. Let me describe the sequence. I import a json file of a object that defines my data. This object needs some functions that were removed when the object was saved as a json file, so after importing it (which parses it into an object again), I inject the required functions. Then I immediately pass the object to a function in another file, where some of the object's properties are saved for easy reference. One of the functions is used here. But Wallaby flags this as not a function. This is strange since in other tests this function is used with no problem. I'm thinking this is a timing problem, and Wallaby is parsing the code in the receiving file before the injected function is visible. Here's some code snippets to show what is happening.
This code works, but Wallaby says theArray is not a function. In my VSCode debugging mode I can step through the code and inspect the object where I see all the injected functions in the object. The Wallaby output is this.
Note: the error report about my suite must contain one test is a side effect of the error about theArray is not a function. If I comment out the line in file2 with theArray()[0], all error reports go away.
Wallaby diagnostics report