diff --git a/Makefile b/Makefile
index 6074f541c7..8a27365aa9 100644
--- a/Makefile
+++ b/Makefile
@@ -359,7 +359,7 @@ test-backend:
 	@$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='$(TEST_TAGS)' $(GO_PACKAGES)
 
 .PHONY: test-frontend
-test-frontend:
+test-frontend: node_modules
 	@NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest --color
 
 .PHONY: test-check
diff --git a/jest.config.js b/jest.config.js
index 317b64d7c1..f95ef1c39c 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,8 +1,9 @@
 export default {
   setupFilesAfterEnv: ['jest-extended'],
   testTimeout: 20000,
+  rootDir: 'web_src',
   testMatch: [
-    '**/web_src/**/*.test.js',
+    '<rootDir>/**/*.test.js',
   ],
   transform: {},
   verbose: false,