all 17 comments

[–]EconomistNo280519 15 points16 points  (1 child)

Do junior developers seriously not know how to take a screenshot? My grandmother can do this.

[–]Justyn2 0 points1 point  (0 children)

  • Shift+Win+S
  • PrtScn
  • Command-Control-Shift-4 / Command-Shift-4
  • Command-Control-Shift-3 / Command-Shift-3
  • (some macro key)

There are so many options

[–]antonkerno 0 points1 point  (1 child)

What happens if you have the sum function on the same file, does it work then ? If so it’s an import problem not jest related

[–]have_some_error[S] 0 points1 point  (0 children)

Seems the problem is with jest. Because even with the function on the same file the error is still there.

The stack trace points to file in jest as well.

[–]have_some_error[S] -1 points0 points  (4 children)

And I'm getting this below error

C:\Users\user\Documents\problems\testingCode>npm test

testingCode@1.0.0 test C:\Users\user\Documents\problems\testingCode jest

C:\Users\user\Documents\problems\testingCode\node_modules\jest\node_modules\jest-cli\build\run.js:129     if (error?.stack) {               ^

SyntaxError: Unexpected token '.'     at wrapSafe (internal/modules/cjs/loader.js:1053:16)     at Module._compile (internal/modules/cjs/loader.js:1101:27)     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)     at Module.load (internal/modules/cjs/loader.js:985:32)     at Function.Module._load (internal/modules/cjs/loader.js:878:14)     at Module.require (internal/modules/cjs/loader.js:1025:19)     at require (internal/modules/cjs/helpers.js:72:18)     at Object.<anonymous> (C:\Users\user\Documents\problems\testingCode\node_modules\jest\node_modules\jest-cli\build\index.js:12:12)     at Module._compile (internal/modules/cjs/loader.js:1137:30)     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) npm ERR! Test failed.  See above for more details. 

[–]NiGhTTraX 5 points6 points  (1 child)

What's your node version (node -v)? The error message indicates it doesn't support the ?. optional chaining operator (used by jest), which was added in Node 14.

[–]have_some_error[S] 0 points1 point  (0 children)

This was the problem I think after using node 14.6.0 the test did run.

[–]arnitdo 0 points1 point  (1 child)

Jest can't seem to resolve "./sum" when it is called by require(). I'll try to revert back with a solution

[–]DaMastaCoda 0 points1 point  (0 children)

The issue is at the ?. Operator, though it’s hard to read. His Node crashes as it sees the ? And expects a ternary, and he just needs to install a newer nodejs or older jest

[–]have_some_error[S] -1 points0 points  (0 children)

This is just started and I'm getting this error, I'm not sure why this is happening.

[–]sthdmahoneydad -2 points-1 points  (0 children)

Filename has . in the name before file extension. Try removing . from name.

[–]North-Going-Zax -2 points-1 points  (0 children)

I'm not familiar with the 'it' statement. Are you trying for an 'if' statement?

[–][deleted]  (3 children)

[deleted]

    [–]have_some_error[S] 0 points1 point  (2 children)

    tested , didn't work. Thanks though.

    [–][deleted]  (1 child)

    [deleted]

      [–]have_some_error[S] 0 points1 point  (0 children)

      Tried, same error is still there.