GithubHelp home page GithubHelp logo

Comments (10)

lenntt avatar lenntt commented on July 28, 2024

I can confirm this issue.
I tried the workaround, which works... though I'd prefer a stronger regex (since I'm logging objects and array).

I guess this is the part we want to capture:

[
   {
     "elements": [
       {
          "id": ".......",
          .....

from grunt-cucumberjs.

shaneobrien20 avatar shaneobrien20 commented on July 28, 2024

Hi SirLenz0rlot, couldn't agree more about stronger regex.

Try this, seems to work for both:

/\[\s*{\s*\"|\[\"/g

All I added was a pipe in the middle there, searching for either object start or array start. It satisfies the above example but would probably need some more thorough testing.

from grunt-cucumberjs.

lenntt avatar lenntt commented on July 28, 2024

To make this more reliable, the whole flow of the json should be improved.

I noticed that when I console.log something in a AfterFeatures handler, the json breaks too :S

from grunt-cucumberjs.

lenntt avatar lenntt commented on July 28, 2024

The regex I suggested is a bad one by the way. The first property can as well be a "description"

from grunt-cucumberjs.

gkushang avatar gkushang commented on July 28, 2024

@shaneobrien20 @SirLenz0rlot thanks for your inputs. I agree about improving on JSON parsing and do not depend on RegEx for future compatibility.

Let's not parse the JSON based on RegEx, instead read the JSON file created at the end of run. Since Cucumber's formatter -f json: fileName.json writes the JSON for HTML reporting, it can be used to create HTML.

from grunt-cucumberjs.

gkushang avatar gkushang commented on July 28, 2024

Hi @shaneobrien20 @SirLenz0rlot - PR #75 will fix the JSON parsing issue as we do not depend on RegEx anymore. Would you guys mind to test it out by pulling the module thru
"grunt-cucumberjs": "git+ssh://[email protected]/gkushang/grunt-cucumberjs.git#tests"
or
npm i git+ssh://[email protected]/gkushang/grunt-cucumberjs.git#tests till it's merged and publish?

from grunt-cucumberjs.

lenntt avatar lenntt commented on July 28, 2024

I'm afraid it doesn't work for me.
jsonOutput doesn't seem like valid json to me, as all the console.log() from the test code gets in there too.

I guess this is caused by reading the entire buffer (jsonOutput = Buffer.concat(buffer).toString(); in processHandler)

from grunt-cucumberjs.

lenntt avatar lenntt commented on July 28, 2024

Let's get rid of reading from the buffer!

in cucumber.js:35, couldn't we just replace:

                commands.push('-f', 'json');

by

                commands.push('-f', 'json:' + options.output + '.json' );

Then, I think we should remove the saveJson option (since its always true when enabling html) and in processHandler throw if the json doesnt exist instead of trying to read from buffer.

Edit: working on a PR

from grunt-cucumberjs.

gkushang avatar gkushang commented on July 28, 2024

@SirLenz0rlot Can you share your cucumberjs "options"?

from grunt-cucumberjs.

gkushang avatar gkushang commented on July 28, 2024

Published @0.10.1. Here is the CHANGELOG

from grunt-cucumberjs.

Related Issues (20)

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.