From 5be72c96423e98f66f8b40e7c8c9f7738e3298a4 Mon Sep 17 00:00:00 2001 From: jisoo youn Date: Sun, 31 Jan 2021 20:34:50 +0900 Subject: [PATCH] =?UTF-8?q?Jest=EC=97=90=EC=84=9C=20Require.context=20is?= =?UTF-8?q?=20not=20function=20=EC=9D=B4=EB=9D=BC=EB=8A=94=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EA=B0=80=20=EB=B0=9C=EC=83=9D=ED=95=A0=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...34\354\203\235\355\225\240\353\225\214.md" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "Jest/jest\354\227\220\354\204\234_require_context_is_not_function_\354\227\220\353\237\254\352\260\200_\353\260\234\354\203\235\355\225\240\353\225\214.md" diff --git "a/Jest/jest\354\227\220\354\204\234_require_context_is_not_function_\354\227\220\353\237\254\352\260\200_\353\260\234\354\203\235\355\225\240\353\225\214.md" "b/Jest/jest\354\227\220\354\204\234_require_context_is_not_function_\354\227\220\353\237\254\352\260\200_\353\260\234\354\203\235\355\225\240\353\225\214.md" new file mode 100644 index 0000000..963f2b5 --- /dev/null +++ "b/Jest/jest\354\227\220\354\204\234_require_context_is_not_function_\354\227\220\353\237\254\352\260\200_\353\260\234\354\203\235\355\225\240\353\225\214.md" @@ -0,0 +1,19 @@ +# Jest에서 Require.context is not function 이라는 에러가 발생할 경우 + +# 해결 +[babel-plugin-transform-require-context](https://www.npmjs.com/package/babel-plugin-transform-require-context) 플러그인을 설치한 후에 +```shell +npm install -dev babel-plugin-transform-require-context +``` + +`.babelrc` 혹은 `babel.config.js` 에 플러그인을 추가해주면 된다. + +```json +{ + "env": { + "test": { + "plugins": ["transform-require-context"] + } + } +} +```