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.

Issue with using Jasmine alongside jest-playwright

See original GitHub issue

Hello,

I was using Jasmine to add reporters and get name of a test with Puppeteer. After Playwright migration, it is no longer working.

My jest.setup.js looks like this:

jasmine.getEnv().addReporter({
    specStarted: result => jasmine.currentTest = result,
    specDone: result => jasmine.currentTest = result,
    suiteStarted: result => jasmine.currentSuite = result,
    suiteDone: result => jasmine.currentSuite = result,
});

Whenever I try to execute some tests, I am getting an error:

   ReferenceError: jasmine is not defined

    > 1 | jasmine.getEnv().addReporter({
        | ^
      2 |     specStarted: result => jasmine.currentTest = result,
      3 |     specDone: result => jasmine.currentTest = result,
      4 |     suiteStarted: result => jasmine.currentSuite = result,

      at Object.<anonymous> (test-environment/jest.setup.js:1:1)

Is there any possible solution?

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
hananmalkacommented, Jan 18, 2021

Try to add to your jest.config.js: testRunner: “jasmine2”

This works for me.

1reaction
mxschmittcommented, Jan 27, 2021

Thanks @hananmalka, please reopen if the issue is still persistent. Its not intended to use it in combination with Jasmine but we are open to add guides / documentation for it if it works already.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Jest with Playwright
Using Jest with Playwright. In this blog post, we'll compare two Jest setups for creating and running end-to-end tests with Playwright.
Read more >
Jest vs Mocha vs Jasmine: Comparing The Top 3 ...
In this blog, we compared three of the top JavaScript testing frameworks, i.e., Jest vs Mocha vs Jasmine - to help you pick...
Read more >
Configuring Jest
Jest will run .mjs and .js files with nearest package.json 's type field set to module as ECMAScript Modules.
Read more >
Test Group & Hooks | Playwright Tutorial - Part 25 - YouTube
Hello Guys, In this video, we'll discuss the test runner group and hooks.Source code:https://github.com/ortoniKC/ Playwright -Test-RunnerAfter ...
Read more >
Why can't nested describe() blocks see vars defined in ...
The body of a describe block is executed before the beforeEach blocks. This is exactly as expected. The problem is that your var...
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