microsoft/DefinitelyTyped-tools

Failure in `@definitelytyped/utils` parallel processing handling.

moltar opened this issue · 1 comments

moltar commented

I'm trying to use @definitelytyped/definitions-parser to build a types index.

It throws here:

assert(outputsLeft > 0);

Using the following script:

import { getDefinitelyTyped, parseDefinitions } from '@definitelytyped/definitions-parser'

const definitelyTypedPath = '../DefinitelyTyped'

async function main() {
  const fs = await getDefinitelyTyped({
    definitelyTypedPath,
    progress: true,
    parseInParallel: true,
  }, console)

  await parseDefinitions(fs, {
    definitelyTypedPath,
    nProcesses: 1,
  }, console)
}

main().catch(e => console.error(e))

Running it:

❯ npx tsx index.ts
Using local DefinitelyTyped at ../DefinitelyTyped
Parsing definitions...
Found 8662 packages.
Parsing in 1 child process(es)...
node:assert:400
    throw err;
    ^

/foo/definitions-parser/node_modules/@definitelytyped/utils/dist/process.js:55
                (0, assert_1.default)(outputsLeft > 0);
                             ^

AssertionError [ERR_ASSERTION]: false == true
    at ChildProcess.<anonymous> (/foo/definitions-parser/node_modules/@definitelytyped/utils/dist/process.js:55:30)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at emit (node:internal/child_process:946:14)
    at processTicksAndRejections (node:internal/process/task_queues:84:21) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Note, I did a checkout of the repo at the level above:

git clone --depth 1 git@github.com:DefinitelyTyped/DefinitelyTyped.git

This code was removed in #771; most things are now lazy so loading no longer needs to be parallelized.