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.

False negatives when using variable named `fit` (`no-focused-tests` & `no-test-prefixes`)

See original GitHub issue

Heya, I have a module called fit which is being imported in a non-test file. However, this plugin seems to think that this file has a test in it (because it searches for “it” ?) and throws two errors:

const { width, height, scale } = fit(
  this.props.frameSize, container, { apply: false }
);

Unexpected focused test  jest/no-focused-tests Use "it.only" instead    jest/no-test-prefixes

I’m guessing this is not supposed to happen, so I wanted to report it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
marcohamersmacommented, Sep 24, 2019

I guess part of the problem might also be that it’s looking inside a file that wouldn’t normally be loaded by jest. By default jest seems to only load files ending in .test.js, .spec.js, etc…, so maybe this behaviour can be mirrored?

Might not be the ideal solution, but it would probably also lower the probability of errors like this?

0reactions
G-Rathcommented, Jun 4, 2022

Resolved with the new jest function call parsing logic, which requires functions to either be globals or imported from @jest/globals.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karate | Test Automation Made Simple.
Note that the Java class does not need to be public and even the test methods do not ... and then set up...
Read more >
Basic Statistical Analysis Using the R Statistical Package - SPH
The attach( ) command. For convenience, the individual variables in a data set can also be named without the dataframename prefix. The 'attach()'...
Read more >
lavaan: Latent Variable Analysis
Description Fit a variety of latent variable models, including confirmatory factor analysis, structural equation modeling and latent growth ...
Read more >
XSL Transformations (XSLT) Version 3.0 - W3C
Note : The use of the term tree in this document does not imply the use of ... The initial named template is...
Read more >
19 Functions | R for Data Science - Hadley Wickham
The focus of this chapter is on writing functions in base R, ... it's a good idea to rewrite the code using temporary...
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