You have configured Babel in the configuration of your web package, and this will only apply to the web package. When other tools, such as Jest, use Babel, they will not see this configuration because they do not look at the webpack configuration. You can use the .babelrc file to configure Babel, and this will apply to everything that runs Babel (not just the web package).
Using. babelrc is usually preferable since you want to have a common babel configuration, and if you need to override the setting, you can still do it in a specific application, as in the webpack configuration.
Create the following .babelrc:
{ "presets": ["es2015", "react"] }
With this, you can remove the presets option in the configuration of your web package because it will use .babelrc. Note that the [cacheDirectory] [3] option is specific to babel-loader and is not used to configure the underlying Babel.
You also have a typo in the test, toMatchSnapShot () should be toMatchSnapshot ().
expect(rendered.toJSON()).toMatchSnapshot();
source share