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.

React folks often use Jest. I think it would be good to add it’s config by default.

I get lots of errors like:

  3:1  'describe' is not defined.  no-undef
  4:3  'test' is not defined.      no-undef

I guess better defaults would be to allow them in test files

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sheeruncommented, Feb 12, 2019

Hmm suddenly it’s working for me as well, I think it’s because I’ve experimented with .lyntrc and made something like this and forgot about it:

{
  "env": {
    "jest": true
  }
}

It seems such .lyntrc is incorrect overrides CLI flag (usually CLI flags have priority over configuration).

1reaction
sheeruncommented, Feb 12, 2019

I guarantee that 90% of react devs are using Jest for testing. Also I think the discussion about these variables going non-global in Jest is not relevant, as status quo for this moment is that they are global and Lynt is supposed to be “Zero configuration by default” 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Jest
It is recommended to define the configuration in a dedicated JavaScript, TypeScript or JSON file. The file will be discovered automatically, if ...
Read more >
How to write a Jest configuration file
If you want to use the package.json to configure jest, add the "jest" key and then your configuration. // package.json { "name" ...
Read more >
Configuring package.json · Jest
Jest's configuration can be defined in the package.json file of your project or through the --config <path/to/json> option.
Read more >
Adding a Jest Setup File - Test-Driven React [Book]
Adding a Jest Setup File Since this chapter's project will have three components (Carousel, CarouselButton, and CarouselSlide), it's going to have three ...
Read more >
jest-config | Yarn - Package Manager
Jest will set process.env.NODE_ENV to 'test' if it's not set to something else. You can use that in your configuration to conditionally setup...
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