jest-mongodb
jest-mongodb copied to clipboard
Validation Error: Preset @shelf/jest-mongodb not found.
I'm getting the following validation error:
● Validation Error:
Preset @shelf/jest-mongodb not found.
Configuration Documentation:
https://facebook.github.io/jest/docs/configuration.html
This is what my jest.config.js looks like:
const path = require('path')
module.exports = {
rootDir: path.resolve(__dirname, '../../'),
testMatch: ['<rootDir>\\test\\unit\\specs\\**.js'],
moduleFileExtensions: [
'js',
'json',
'vue'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
},
testPathIgnorePatterns: [
'<rootDir>/test/e2e',
'<rootDir>/test/unit/specs/bundle'
],
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
setupFiles: ['<rootDir>/test/unit/setup'],
coverageDirectory: '<rootDir>/test/unit/coverage',
collectCoverageFrom: [
'src/**/*.{js,vue}',
'!src/main.js',
'!src/router/index.js',
'!**/node_modules/**'
],
verbose: true,
testURL: 'http://localhost/',
preset: '@shelf/jest-mongodb'
}
I installed @shelf/jest-mongodb with the following command:
npm install @shelf/jest-mongodb --also=dev
Any ideas?
Edit: I have tried deleting node_modules and package-lock.json, this didn't work.
Duplicated with #121 I let you my example
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
const tsPreset = require('ts-jest/jest-preset')
const mongoPreset = require('@shelf/jest-mongodb/jest-preset')
module.exports = {
...tsPreset,
...mongoPreset,
testEnvironment: 'node',
modulePathIgnorePatterns: ["<rootDir>/.aws-sam", "<rootDir>/dist"]
}
I also got the same error. I was able to resolve it by installing the dependency using yarn even though it was already installed using npm. source
yarn add @shelf/jest-mongodb --dev