Giter VIP home page Giter VIP logo

Comments (8)

StarpTech avatar StarpTech commented on June 5, 2024 1

What do you think about a custom reporter based on unist-util-inspect? Something like this:

Should be equivalent
	---
root[1] (1:1-1:23, 0-22) [data={"quirksMode":true}]
└─ element[2] [tagName="html"]
   ├─ element[0] [tagName="head"]
   └─ element[1] [tagName="body"]
-      └─ element[1] (1:1-1:23, 0-22) [tagName="h2"]
         └─ Expected: text: "Hello, world!" (1:5-1:18, 4-17)
	 	 └─   Actual: text: "Hello, world"

from hast-util-from-parse5.

wooorm avatar wooorm commented on June 5, 2024

Yeah, it sucks. And I don’t know of a good solution (your proposal, or e.g., comparing JSON.stringify(actual)), are property-order-sensitive.

I just log both trees (console.log(actual, {depth: null})), and paste it into diffchecker 🤷‍♂️

from hast-util-from-parse5.

wooorm avatar wooorm commented on June 5, 2024

Ah, you can pass opts.objectPrintDepth to tape! It defaults to 5, but you can set it higher (maybe null) works as well? Or run the tests like so: NODE_TAPE_OBJECT_PRINT_DEPTH=99 node test

I think this should be something that isn’t checked in (like t.skip) though, so I’d add this when stuff is failing and remove it before checking changes in!

from hast-util-from-parse5.

StarpTech avatar StarpTech commented on June 5, 2024

Thanks for the tips. What do you mean with yesyes, yesno in the tests?

from hast-util-from-parse5.

StarpTech avatar StarpTech commented on June 5, 2024

@wooorm I switched to https://github.com/avajs/ava now. It has excellent support for diffing and is inspired by tap and tape. By the way it also generate much better test error messages. In the example below you can see I added the data property to the object.

 1 failed

  hast-util-from-parse5

  E:\Repositorys\prettyhtml\packages\prettyhtml-hast-util-from-parse\test\index.js:297

   296:
   297:   t.deepEqual(
   298:     fromParse5(

  should transform svg

  Difference:

    {
      children: [
        {
          children: [
            Object { … },
            {
              children: [],
  -           data: {
  -             selfClosing: true,
  -           },
              properties: Object { … },
              tagName: 'circle',
              type: 'element',
            },
            Object { … },
          ],
          properties: Object { … },
          tagName: 'svg',
          type: 'element',
        },
      ],
      data: Object { … },
      type: 'root',
    }

from hast-util-from-parse5.

wooorm avatar wooorm commented on June 5, 2024

Looks very nice!
I feel like ava does a bit too much for what I need though, tape is fast and fine for me!

from hast-util-from-parse5.

StarpTech avatar StarpTech commented on June 5, 2024

Could you elaborate? I couldn't feel any performance regression and ava advertises with a light and performant solution. Therefore it comes with very great features, based on the needs for syntax-tree e.g out of the box support for promises, parallization, diffing, snapshotting.

The biggest drawback is the browser support. What's the general descision about it?

from hast-util-from-parse5.

wooorm avatar wooorm commented on June 5, 2024

Nothing! Ava is great. Tape is good enough. I’m just not going to rewrite test suites for ± 400 projects for something quite similar!

from hast-util-from-parse5.

Related Issues (5)

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.