Giter Site home page Giter Site logo

Offer to help about loupe HOT 4 CLOSED

chaijs avatar chaijs commented on June 12, 2024
Offer to help

from loupe.

Comments (4)

keithamus avatar keithamus commented on June 12, 2024 1

Yes, sadly I broke the cardinal sin of using git! I left the new code on my machine and then my Mac went to the apple store and they formatted my machine despite me telling them not to!

Help is definitely welcome! The biggest drag I had during development was writing tests to catch all the conditions we’d hit.

I’ll come back to this issue in a bit with an action plan on what to do next.

from loupe.

maxnordlund avatar maxnordlund commented on June 12, 2024

Yes, sadly I broke the cardinal sin of using git! I left the new code on my machine

Haven't we all 😉 but ...

... and my Mac went to the apple store and they formatted my machine despite me telling them not to!

That's a real bummer 😿

Help is definitely welcome! The biggest drag I had during development was writing tests to catch all the conditions we’d hit.

Tests sounds like fun, and that's something I can definitely contribute once I've seen an example. I guess we could make it super easy using some sort of factory/helper? I can happily write one of those we the time comes. (I have been writing custom assertions for a private project and it's been a real treat to make my tests look ✨ nice ✨)

I’ll come back to this issue in a bit with an action plan on what to do next.

Good, I'm looking forward to it. In the other issue I linked to node's current inspect implementation, I think a fair amount can be borrowed from there. To cut down on the work, right?

from loupe.

keithamus avatar keithamus commented on June 12, 2024

Hey @maxnordlund! Happy new year!

Over the Christmas holidays I managed to source a slightly outdated backup of loupe@2 code, and get it in working order so we have something that closely resembles what I had before. It lives in the v2 branch and is also over on #14.

Right now test coverage isn't perfect so if you have time to contribute tests that would be 🎉 amazing.

We really need some good acceptance tests to cover some edge cases, to make sure the code is working as it should do. I've written 2 tests to get you started:

describe('arrays', () => {
it('an array of strings truncates the array when it can', () => {
expect(inspect(['foo', 'bar', 'baz', 'bing'], { truncate: 22 })).to.equal("[ 'foo', 'bar', …(2) ]")
})
it('an array of strings truncates the strings when it can', () => {
expect(inspect(['foobarbazbing'], { truncate: 15 })).to.equal("[ 'foobarba…' ]")
})
})

So to write more it's a case of calling inspect() with some object, and wrapping that in a chai expect test, so the whole thing is:

expect(inspect({})).to.equal('{}')

Coming up with some examples is the harder part - finding some objects in your existing code bases or trying to come up with esoteric examples that will break the code would be awesome!

Happy testing!

from loupe.

keithamus avatar keithamus commented on June 12, 2024

Closing this in favour of #15

from loupe.

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.