olyckne / jest-runner-phpunit Goto Github PK
View Code? Open in Web Editor NEWA PHPUnit runner for Jest
License: MIT License
A PHPUnit runner for Jest
License: MIT License
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.