node
-
[JavaScript] Jest encountered an unexpected token 해결Computer Science/JavaScript 2023. 1. 16. 21:01
Jest encountered an unexpected token SyntaxError: Cannot use import statement outside a module node js 에서 Test code를 Jest로 작성하던 중 해당 오류를 만났다. import 쪽에서 오류가 발생하였다는데 해결하는데 꽤 시간이 걸렸다. 오류의 근본적인 원인으로는 jest는 현대 문법의 js를 test 하지 못하여서 생긴다. (import 가 불가한 이유 -> Require 사용) https://dev.to/bytebodger/how-i-fixed-the-unexpected-token-error-in-jest-4o1j How I Fixed The Unexpected Token Error In Jest I recentl..