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.

No tests found in your file

See original GitHub issue

HI,

I have tried to set up a project with cypress / cypress-cucumber-preprocessor and typescript without much success. I’ve decied to give it a shot without typescript. However, it’s like Cypress is not recognizing my tests. I’m getting this error:

 No tests found in your file:
/my-project/test/cypress/integration/google.js
We could not detect any tests in the above file. Write some tests and re-run.

This is my plugins/index.js I have

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = on => {
  on('file:preprocessor', cucumber())
}

My cypress.json file

{
  "ignoreTestFiles": "*.feature"
}

My package.json file

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "cypress": "cypress open"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@cypress/webpack-preprocessor": "^4.0.2",
    "@types/node": "^10.12.18",
    "awesome-typescript-loader": "^5.2.1",
    "cypress": "^3.1.4",
    "cypress-cucumber-preprocessor": "^1.9.1",
    "typescript": "^3.2.2"
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true
  }
}

This is my feature file google.feature

Feature: The Google

  I want to open Google page

  @focus
  Scenario: Opening a the Google home page
    Given I open Google page
    Then I see "google" in the title

And this is my google.spec.js file

import { Given, Then } from "cypress-cucumber-preprocessor/steps";

const url = 'https://google.com'
Given(/^I open Google page?/, () => {
  cy.visit(url)
})

Then(/I see "google" in the title?/, () => {
  console.log("google :)")
})

What am I doing wrong?

Thank you

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
sawasawasawacommented, Dec 27, 2018

Hi, @alveshelio, happy to see you trying out this library.

To start with - you do not need need this line "ignoreTestFiles": "*.feature" in your cypress.json.

Secondly - where do you have your google.spec.js file? Is it located anywhere else than cypress/support/step_definitions/ you should add some extra config to your package.json, as described here https://github.com/TheBrainFamily/cypress-cucumber-preprocessor#step-definition-location-configuration

1reaction
alvesheliocommented, Dec 28, 2018

Hi @lgandecki,

Yes it did work, I’ve used "nonGlobalStepDefinitions": true

Thank you very much for the support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting No Tests Found In your File error, but I do have a test ...
As far as the log concern, it shows that app-init.spec.js file doesn't exist in ...
Read more >
Adding new test file results in "No tests found" #19822 - GitHub
Any new file created does not have its specs detected, even if their contents exactly match that of the working App.test.tsx. This persists ......
Read more >
Error Messages | Cypress Documentation
No tests found. This message means that Cypress was unable to find tests in the specified file. You'll likely get this message if...
Read more >
Android : JUnit4 - AssertionFailedError: No tests found
Android : JUnit4 - AssertionFailedError: No tests found [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Android ...
Read more >
ConnectedAndroidTest still run even there is no test files with ...
2 com.android.build.gradle.internal.testing.ConnectedDevice > No tests found.[test(AVD) - 5.0.2] FAILED No tests found ...
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