Skip to content

Path resolution issues with Jest@20 #3542

Description

@kentcdodds

Do you want to request a feature or report a bug?

bug

What is the current behavior?

I'm unsure what's happened, but maybe a diff will help reveal what's going on.

Here's how I had to change things when upgrading from a working Jest@19 setup to an almost working setup with Jest@20

diff --git a/tests/jest.config.client.json b/tests/jest.config.client.json
index 242ccad0ed..9abc83cdb3 100644
--- a/tests/jest.config.client.json
+++ b/tests/jest.config.client.json
@@ -1,13 +1,13 @@
 {
   "roots": [
-    "<rootDir>/public/js"
+    "../public/js"
   ],
   "setupFiles": [
-    "<rootDir>/tests/lib/setup-test-env-jest-client.js"
+    "./lib/setup-test-env-jest-client.js"
   ],
-  "setupTestFrameworkScriptFile": "<rootDir>/tests/lib/before-each-test-client.js",
+  "setupTestFrameworkScriptFile": "./lib/before-each-test-client.js",
   "transform": {
-    "^.+\\.js$": "<rootDir>/tests/lib/client-preprocessor.js"
+    "^.+\\.js$": "./lib/client-preprocessor.js"
   },
   "testURL": "http://example.com",
   "testPathIgnorePatterns": [
@@ -15,7 +15,7 @@
     "/__tests__/helpers/",
     "/__tests__/fixtures/"
   ],
-  "testEnvironment": "jest-environment-jsdom",
+  "testEnvironment": "jsdom",
   "moduleNameMapper": {
     "^.+\\.svg$": "<rootDir>/public/js/__mocks__/custom/file-mock.js"
   },

I think this is important to note: My config is located in <rootDir>/tests/jest.config.client.json and my root is in <rootDir>/public/js.

Really sorry I was unable to try the alpha out on my project :-(

With these changes, Jest starts running the tests, but it appears it's not transpiling things properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions