Comments (5)
Behat currently uses its own parser which isn't 100% compatible with the Cucumber one. We do attempt to test against the same testdata but exclude some of the example features . The data table examples don't seem to be in that exclusion list, which indicates the Behat parser produces the same result as Cucumber for those testdata.
Therefore a good step would be to add an example with this problematic case to the testdata in this repo and canonicalise the correct parsing. This would help us ensure that other implementations are parsing the source in the same way too.
The good news is that Behat should use the new parser at some point which will mean the parsing will be much more compatible, and maintained in this organisation
from common.
Unfortunately this looks like a feature to me:
common/gherkin/java/src/main/java/io/cucumber/gherkin/GherkinLine.java
Lines 98 to 114 in da2508f
Though since the escape is invalid, I think you might be okay mapping every \
to \\
. I don't immediately see any clashes.
So reformatting:
| \o\no\ |
Should yield
| \\o\no\\ |
from common.
OK thank you for your fast response.
One think I find weird then (but that possibly because I do not know the implementation details here) is the fact that there is a difference between \|
and the rest : \|
are converted to |
. But after reading my phrase several times, it seems logical as you want the cell value here.
About mapping \
to \\
, that's what I did, but I think that Behat does not escape the same way as cucumber handles it, so changing from \
to \\
in gherkin files does crash on the Behat side (I might open an issue about this when I do investigate a little further on their side).
For the moment I'm still stucked on the prettier plugin, and the hack I found is not pretty 😰
https://github.com/mapado/prettier-plugin-gherkin/blob/main/src/GherkinAST/index.ts#L46-L59
https://github.com/mapado/prettier-plugin-gherkin#escapebackslashes
But it does work for the moment, so that's fine 👍
As an evolution, what do you think about adding the initial data in the AST ? or at least the a endColumn
information in the Location
of every nodes ? This way we might get the original data when we want (I can not actually do that because the size of the TableCell
is lost as the value
is transformed).
Thanks again
from common.
About mapping \ to \, that's what I did, but I think that Behat does not escape the same way as cucumber handles it, so changing from \ to \ in gherkin files does crash on the Behat side (I might open an issue about this when I do investigate a little further on their side).
I think that would be the way forward. I know that @ciaranmcnulty contributes to both Cucumber Gherkin and Behat Gherkin. Perhaps he can help out.
from common.
@ciaranmcnulty thank you for your response.
The file I did work with is escaped_pipes.feature
that is in your list. I did not remember all other files.
I did add a file with lots of \
in my test stack and the actual output of the prettier plugin is visible here (but with backslashes escaped, which is nearly unreadable 😄 ).
I think the fix for the prettier plugin should work for now. I will watch carefully the fact that behat will use the cucumber parser and test it once released.
I'm closing this as the option in the prettier plugin should handle most cases.
Thanks @mpkorstanje too for your time.
from common.
Related Issues (20)
- Use arguments in scenario outline to describe test name HOT 3
- Github is deprecating set-output commands HOT 3
- Grouping Scenarios in .feature Files Using Multiple 'Feature' Keywords HOT 5
- Incorrect status being reported for skipped, pending, failed steps v16.0.3 HOT 7
- Tools page sidebar in when scroll the menu line should not overlap on text. HOT 1
- [Gherkin language feature support] Gherkin can support StepMacros syntax? HOT 5
- how to run prallel all the scenario outline methods with Examples but the test data are in the excel file HOT 1
- Add prettier plugin support for Gherkin HOT 2
- Cucumber html report screen is blur and couldn't able to access the report HOT 1
- Support for triggering/transforming parameterTypes in data table HOT 2
- allow more steps to execute after step failure HOT 9
- How to get Feature File commented lines in Cucumber Json Test Report HOT 7
- We're currently locked out of our npm account HOT 3
- We don't have access to the [email protected] email address HOT 2
- [email protected] email address doesn't forward to the core team HOT 10
- DKIM etc headers for cucumber.community HOT 6
- Slack inviter is broken HOT 11
- Can't register for slack for cuke HOT 1
- Cucumber Reports Collection - how to remove a collection? HOT 1
- Cucumber Report NOT WORKING HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from common.