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.

Global jest variables not injected when using `jestCLI` in Atom.

See original GitHub issue

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

Bug, maybe?

What is the current behavior?

Attempting to use Jest as a runner for testing Atom package.

I’m able to get Atom to run Jest, which begins to run the test files, but none of the global Jest variables get injected into the test files.

ReferenceError: test is not defined

Here is the code being used to call jestCLI()

https://github.com/AtomLinter/linter-eslint/blob/7dbda8673e57f34c29515ea3b4b6358e7e071ecf/runner-jest.js

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

Not sure if it is a bug because there is no documentation for the jest-cli api. I’ll look into moving this into a separate minimal repo soon if required.

What is the expected behavior?

Jest will inject globals into the test script and run them.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Windows 10.0.17025 Build 17025 npm 5.5.1 node 8.9.1 Jest 22.1.1 No Jest configuration except the variables being passed into jestCLI()

versions reported by apm: apm 1.18.12 npm 3.10.10 node 6.9.5 x64 atom 1.23.3 python 3.6.4 git 2.14.2.windows.2 visual studio

versions reported by Atom Atom : 1.23.3 Electron: 1.6.15 Chrome : 56.0.2924.87 Node : 7.4.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
skylizecommented, Jan 16, 2018

Oh, haha. I see why you wanted a more descriptive title. I swear I typed a real title the first time. I remember it word for word. 🙈

0reactions
github-actions[bot]commented, Apr 27, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use a Global Variable in Jest - Stack Overflow
I can only find articles on creating the variable, but not on how to call it. Source: https://jestjs.io/docs/en/configuration#globals-object.
Read more >
Globals - Jest
This does not consume an argument. Or generate unique test titles by injecting properties of test case object with $variable.
Read more >
jest-environment-node | Yarn - Package Manager
mock with three arguments. The JSON global in jest-environment-node now comes from the vm context instead of the parent context. Jest does not...
Read more >
jest-repl: Versions | Openbase
[jest-runner] Do not instrument v8 coverage data if coverage should not be ... [jest-transform] Attempt to work around issues with atomic writes on...
Read more >
tanner-barlow - npm Package Health Analysis | Snyk
It also only works with npm 3 or higher. Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint....
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