8000 GitHub - tc39/proposal-inspector: ECMAScript Proposal, specs, and reference implementation for Inspector
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tc39/proposal-inspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proposal: Inspector

Champions:

  • @JakobJingleheimer

Authors:

  • @JakobJingleheimer

Current: 1 (30 May 2025)

The Problem

Detailed inspection information in a human-friendly way, such as when comparing (diffing) values.

In the context of Comparisons, merely knowing A is unexpected is almost useless when you can't see what A and B are.

examples (current native capability)

Annoying:

if (A !== B) throw new Error('A does not equal B');
// Error: A does not equal B

Better

if (A !== B) throw new Error(`${A} does not equal ${B}`);
// Error: 1 does not equal 2

But brittle

if (A !== B) throw new Error(`${A} does not equal ${B}`);
// Error: [object Object] does not equal [object Object]
examples (the general desire)
const result = compare(A, B);

{
  pretty: `{

  ✓     qux: 'a',
  ✗     qux: 'b',

  }`,
  paths: ['foo.bar.qux'],
  expected: 'a',
  actual: 'b',
}

Reasons to provide natively:

  • Very expensive for userland to compose (the vast majority of test runner execution time)
    • Pretty printing
  • Special access (requires Modes - will not be available in "production"):
    • Proxies
    • Constituents of expressions (compiler)
    • Constituents of structure (diff)
    • Internal slots
  • Broadly applicable: can be used by more than Comparisons (e.g. Pattern Matching could leverage this; it could be used entirely on its own).

Ecosystem today

Currently, there are several libraries in userland that provide this functionality in varying ways.

Runtimes (can offer special access):

Libraries (cannot offer special access):

Prior to stage 2

  • Consider customisation/extensibility (public symbols?)
    • This is potentially especially important for frameworks that may want to utilise Inspector under the hood and want to tweak only a very small piece.
  • Determine what information to provide, how, and under what cicumstances.
  • Modes as a requirement to offer "special access".

About

ECMAScript Proposal, specs, and reference implementation for Inspector

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

0