November 2017
Beginner to intermediate
398 pages
8h 42m
English
To configure Jest, let's create a new jest.config.js file in the project root directory:
module.exports = { transform: { '.+\\.jsx?$': '<rootDir>/node_modules/babel-jest', '.+\\.vue$': '<rootDir>/node_modules/vue-jest', }, snapshotSerializers: [ '<rootDir>/node_modules/jest-serializer-vue', ], mapCoverage: true,}
The transform option defines processors for the JavaScript and Vue files. Then, we tell Jest to use jest-serializer-vue to serialize the snapshots of the components. We will also enable the source maps with the mapCoverage option.
You can find more configuration options at the Jest website (https://facebook.github.io/jest/).
Read now
Unlock full access