jest-mongodb
jest-mongodb copied to clipboard
Validation warnings from jest with jest-mongodb configuration
I'm getting the following validation warnings when I try to use jest-mongodb:
● Validation Warning:
Unknown option "mongodbMemoryServerOptions" with value {"autoStart": false, "binary": {"skipMD5": true, "version": "4.0.3"}, "instance": {}} was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration
● Validation Warning:
Unknown option "mongoURLEnvName" with value "MONGO_URI" was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration
here's the jest config I'm using which seems to work because it made the globalConfig.json file upon first usage:
const { jsWithTsESM: tsjPreset } = require("ts-jest/presets");
const mongoServerPreset = require("@shelf/jest-mongodb/jest-preset");
module.exports = {
...tsjPreset,
...mongoServerPreset,
globals: {
"ts-jest": {
tsconfig: "tsconfig.json"
}
},
moduleFileExtensions: ["ts", "js"],
testRegex: ".*.test.ts",
mongodbMemoryServerOptions: {
binary: {
version: "4.0.3",
skipMD5: true
},
instance: {},
autoStart: false
},
mongoURLEnvName: "MONGO_URI",
watchPathIgnorePatterns: ['globalConfig'],
};
I'm starting jest with the following npm script:
"scripts": {
// ...
"test": "jest",
// ...
},
How can I configure jest or jest-mongodb correctly such that I don't get the above validation warnings?