Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation Error: Preset @shelf/jest-mongodb not found. #257

Open
adamcole123 opened this issue Mar 27, 2021 · 2 comments
Open

Validation Error: Preset @shelf/jest-mongodb not found. #257

adamcole123 opened this issue Mar 27, 2021 · 2 comments

Comments

@adamcole123
Copy link

adamcole123 commented Mar 27, 2021

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.

@lopezoscar-dev
Copy link

lopezoscar-dev commented Aug 3, 2021

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"]
}

@ritish78
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants