Giter VIP home page Giter VIP logo

jest-runner-phpunit's People

Contributors

gevalo1 avatar olyckne avatar robinmalfait avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

jest-runner-phpunit's Issues

Getting: TypeError: Cannot read property 'map' of undefined; Because I use dataProviders

Hello there!

The jest runner fails whenever I use a @dataProvider. If you are not familiar with a data provider, it is like a test.each() in jest, where you write 1 test, but you can give it different sets of data. (See: https://phpunit.de/manual/6.5/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers)

That said, when I look at the result variable without dataProviders, it looks like this:

{
  "testsuites": {
    "testsuite": [
      {
        "$": {
          "name": "App\\Tests\\Unit\\TestName",
          "file": "TestName.php",
          "tests": "1",
          "assertions": "12",
          "failures": "0",
          "errors": "0",
          "time": "1.193167"
        },
        "testcase": [
          {
            "$": {
              "name": "testSanitation",
              "class": "TestName",
              "file": "TestName.php",
              "line": "27",
              "assertions": "12",
              "time": "1.193167"
            }
          }
        ]
      }
    ]
  }
}

But when I look at the result when I do use data providers, I see the following result:

{
  "testsuites": {
    "testsuite": [
      {
        "$": {
          "name": "TestWithDataProvider",
          "file": "TestWithDataProvider.php",
          "tests": "6",
          "assertions": "6",
          "failures": "0",
          "errors": "0",
          "time": "0.093333"
        },
        "testsuite": [
          {
            "$": {
              "name": "TestWithDataProvider::testNameGoesHere",
              "tests": "6",
              "assertions": "6",
              "failures": "0",
              "errors": "0",
              "time": "0.093333"
            },
            "testcase": [
              {
                "$": {
                  "name": "testNameGoesHere with data set #0",
                  "assertions": "1",
                  "time": "0.031252"
                }
              },
              {
                "$": {
                  "name": "testNameGoesHere with data set #1",
                  "assertions": "1",
                  "time": "0.011367"
                }
              },
              {
                "$": {
                  "name": "testNameGoesHere with data set #2",
                  "assertions": "1",
                  "time": "0.011760"
                }
              },
              {
                "$": {
                  "name": "testNameGoesHere with data set #3",
                  "assertions": "1",
                  "time": "0.011313"
                }
              },
              {
                "$": {
                  "name": "testNameGoesHere with data set #4",
                  "assertions": "1",
                  "time": "0.011672"
                }
              },
              {
                "$": {
                  "name": "testNameGoesHere with data set #5",
                  "assertions": "1",
                  "time": "0.015969"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

The important part here is that there is a test suite inside of the test suite. Which eventually throws TypeError: Cannot read property 'map' of undefined.

I am going to submit a PR for this as well. hold on!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.