chaijs / chaijs.github.io

The chaijs.com website source code. Contributions welcome.
http://chaijs.github.io
49 stars 71 forks source link

The inspect documentation is missing #148

Open xpe opened 7 years ago

xpe commented 7 years ago

On http://chaijs.com/api/plugins/, the sidebar includes 'inspect'. However, that section does not have a section heading like the others. It only shows this:

Echos the value of a value. Trys to print the value out in the best way possible given the different types.

@param { Object } obj The object to print out.
@param { Boolean } showHidden Flag that shows hidden (not enumerable) properties of objects.
@param { Number } depth Depth in which to descend in object. Default is 2.
@param { Boolean } colors Flag to turn on ANSI escape codes to color the output. Default is false (no coloring).
aaronsofaly commented 7 years ago

Hi @xpe, nice catch!

The docs are generated from the chai.js repo. If you want, you can submit a pull request to the chai.js repo which adds the headline.

It looks like this is the file that needs updating, https://github.com/chaijs/chai/blob/master/lib/chai/utils/inspect.js.

You could fix it with this:

/**
 * ### .inspect (obj, showHidden, depth, colors)
 *
 * Echoes the value of a value. Tries to print the value out
 * in the best way possible given the different types.
 *
 * @param {Object} obj The object to print out.
 * @param {Boolean} showHidden Flag that shows hidden (not enumerable)
 *    properties of objects.
 * @param {Number} depth Depth in which to descend in object. Default is 2.
 * @param {Boolean} colors Flag to turn on ANSI escape codes to color the
 *    output. Default is false (no coloring).
 * @namespace Utils
 * @name inspect
 */

Looking at that plugins page, it looks like some of the items have the wrong headline element. They're using h1's instead of h3's.

So you could make additional fixes.

Change https://github.com/chaijs/chai/blob/master/lib/chai/utils/addLengthGuard.js#L12 to:

* ### addLengthGuard(fn, assertionName, isChainable)

Change https://github.com/chaijs/chai/blob/master/lib/chai/utils/getActual.js#L8 to:

* ### getActual(object, [actual])

Change https://github.com/chaijs/chai/blob/master/lib/chai/utils/isProxyEnabled.js#L10 to:

* ### isProxyEnabled()

Change https://github.com/chaijs/chai/blob/master/lib/chai/utils/proxify.js#L13 to:

* ### proxify(object)

Change https://github.com/chaijs/chai/blob/master/lib/chai/utils/test.js#L14 to:

* ### test(object, expression)
xpe commented 7 years ago

Thanks for the detailed look and response.. For now, I just have time to report the issue. (I don't use Chai.) I was helping someone else who was looking at it.

aaronsofaly commented 7 years ago

Okay, no problem!

@keithamus, want me to open a PR?

keithamus commented 7 years ago

For sure @aaronsofaly, sounds great! Look forwarding to merging it 😄