question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@shelf/jest-mongodb does not work with TypeScript

See original GitHub issue

Here the config I am using for jest in jest.config.js:

module.exports = {
  transform: {
    '^.+\\.jsx?$': 'babel-jest',
    '^.+\\.ts?$': 'ts-jest'
  },
  rootDir: './lib',
  roots: ['<rootDir>'],
  moduleFileExtensions: ['ts', 'js', 'json', 'node'],
  preset: "@shelf/jest-mongodb"
};

Jest fails to run tests just saying “Determining test suites to run…”

Works if I replace preset: "@shelf/jest-mongodb" with preset: "ts-jest"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

19reactions
asciidiscocommented, Mar 3, 2020

We use it with a Typescript setup, our jest.config.js looks like this:

const { defaults: tsjPreset } = require('ts-jest/presets')

module.exports = {
  preset: '@shelf/jest-mongodb',
  // ...some other non related config values...
  transform: tsjPreset.transform,
}

// EDIT: But as you see, we’re not using babel, so you might need to configure ts-jest differently, in order to pick up your babel preset: Maybe this helps - https://kulshekhar.github.io/ts-jest/user/config/babelConfig

2reactions
chancedcommented, Jul 9, 2020

@francesco-albanese You left this issue open. Sounds like you should be able to close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure jest-mongodb(@shelf/jest ... - Stack Overflow
Hey I have referred documentation and implemented in javascript code. It works fine and test cases are passing. but when trying with typescript...
Read more >
@shelf/jest-mongodb - npm
Run your tests using Jest & MongoDB in Memory server. Latest version: 4.1.4, last published: a month ago. Start using @shelf/jest-mongodb in ...
Read more >
How to configure jest-mongodb(@shelf ... - appsloveworld.com
Jest MongoDB provides all required configuration to run your tests using MongoDB. Described Here. First you need to install @shelf/jest-mongodb,
Read more >
Using with MongoDB - Jest
Jest MongoDB provides all required configuration to run your tests using MongoDB. First install @shelf/jest-mongodb. npm; Yarn. npm ...
Read more >
How to test MongoDB related functionality with Jest ... - YouTube
In this episode I show you a simple way to test MongoDB related functionality with Jest in Node.js using TypeScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found