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.

Jest compatibility?

See original GitHub issue

Hi! Thanks for sharing this project! I’m trying to use it with Jest, and running into trouble:

myproject-consumer-portal feature/test-architecture ✗ 3h26m △ ➜ yarn test
yarn test v0.24.6
$ jest
 FAIL  src/modules/client/ducks/flow/reducers.spec.js
  ● Test suite failed to run

    /Users/brandon/code/myproject-consumer-portal/src/modules/client/ducks/flow/reducers.spec.js: Unexpected token import

      at createScript (vm.js:53:10)
      at Object.runInThisContext (vm.js:95:10)
      at Module._compile (module.js:543:28)
      at Object.Module._extensions..js (module.js:580:10)
      at Module.load (module.js:488:32)
      at tryModuleLoad (module.js:447:12)
      at Function.Module._load (module.js:439:3)
      at Module.require (module.js:498:17)
      at require (internal/module.js:20:19)
      at PluginPass.CallExpression (node_modules/babel-plugin-webpack-alias/build/index.js:39:28)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.607s
Ran all test suites.
error Command failed with exit code 1.

I’m digging into the source trying to figure out how to work around it, but I don’t have any good leads yet. If anyone has ideas, I’d love to hear them! 😃

My .babelrc:

{
	"presets": ["react", "es2015", "stage-1"],
	"plugins": [
		"add-module-exports",
		"jsx-display-if",
		"transform-class-properties",
		"transform-object-rest-spread",
		[ "babel-plugin-webpack-alias", { "config": "./tools/webpack/webpack.resolve.babel.js", "findConfig": true } ],
		"styletron-react"
	]
}

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
bkonklecommented, Jan 4, 2018

I ended up ditching aliases altogether, and going with lerna and a monorepo structure. 😃

1reaction
giannifcommented, Jan 3, 2018

I wound up using moduleNameMapper in the package.json:

  "moduleNameMapper": {
    "^shared/(.*)$": "<rootDir>/js/shared/$1"
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest 28: Shedding weight and improving compatibility
Jest 28 is finally here, and it comes with some long requested features such as support for sharding a test run across multiple...
Read more >
Jest Versions
Current version (Stable). Latest stable version of Jest ; Latest version. Here you can find the latest unreleased documentation and code. ; Past...
Read more >
Getting Started - Jest
You just successfully wrote your first test using Jest! This test used expect and toBe to test that two values were exactly identical....
Read more >
From v28 to v29 - Jest
Compatibility​. The supported Node versions are 14.15, 16.10, 18.0 and above. Snapshot format​. As announced in the Jest 28 blog post, ...
Read more >
Configuring Jest
That is caused by backward compatibility reasons and process.on('unhandledRejection', callback) signature, but that usually should not be a ...
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