nodejs / nodejs/node-core-utils

git node wpt <name> crashes if <name> isn't found

Open Beginner friendly
#664 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
314
Forks
137
Avg merge
2d 8h
Merged PRs (30d)
24

Description

I just encountered this whilst trying to pull in the FileAPI tests for a backport, and I'd written:

$ git node wpt File

Instead of:

$ git node wpt FileAPI

Which resulted in the following crash:

$ git node wpt File
   ⚠  Please create File.json in test/wpt/status
------------------------- Checking updates for File... -------------------------
No records for File in local test/fixtures/wpt/versions.json
pulling files from scratch...
----------------- Writing assets to test/fixtures/wpt/File... ------------------
⠧ Querying asset list for File...TypeError: Cannot read properties of undefined (reading 'oid')
    at GitHubTree._getLastCommit (file:///usr/local/lib/node_modules/node-core-utils/lib/github/tree.js:38:56)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async GitHubTree.getLastCommit (file:///usr/local/lib/node_modules/node-core-utils/lib/github/tree.js:48:23)
    at async GitHubTree.getFiles (file:///usr/local/lib/node_modules/node-core-utils/lib/github/tree.js:100:20)
    at async WPTUpdater.getAssetList (file:///usr/local/lib/node_modules/node-core-utils/lib/wpt/index.js:61:34)
    at async WPTUpdater.pullAllAssets (file:///usr/local/lib/node_modules/node-core-utils/lib/wpt/index.js:73:16)
    at async WPTUpdater.update (file:///usr/local/lib/node_modules/node-core-utils/lib/wpt/index.js:160:5)
    at async main (file:///usr/local/lib/node_modules/node-core-utils/components/git/wpt.js:80:5)```

It may need a check to see if the specified `<name>` is even a web platform test case, here I'd expect it to exit with -1 and a message saying "We couldn't find the File WPT tests, maybe you misspelled or have the wrong API identifier?"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing git node wpt File, then inspect components/git/wpt.js, lib/wpt/index.js, and lib/github/tree.js along the stack trace. Done means an unknown WPT name exits cleanly with a useful message instead of attempting the lookup and crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.