Jest tests not running properly with mysql usage in NodeJS

I have a NodeJS program that uses Jest for unit tests. Several tests require a MySQL connection to run, which is taken care of in a jestGlobalSetup.js file. When running in the CLI, the tests run properly and without issue. When running through the Webstorm interface, some tests will fail with messages as “Table x doesn't exist”, with x always being the same table, which does exist (in fact, the tests have a beforeEach that drop and create table x). Nothing is changed like which database is used, and most tests that pass also use the database.

What I want to know is whether or not this is a bug in Webstorm or I'm doing something wrong with configuration, as these tests pass without fail on the CLI, both before and after the tests are ran in Webstorm.

1 comment

globalSetup methods are correctly recognized by the IDE, so it must be a configuraton issue

Doyou have a sample project you can share that reproduces it?


Please sign in to leave a comment.