Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError [ERR_ASSERTION]: probably because nested folder also contain node_modules #1462

Closed
Luxcium opened this issue Jan 8, 2021 · 4 comments
Labels
bug Functionality does not match expectation

Comments

@Luxcium
Copy link

Luxcium commented Jan 8, 2021

Search terms

Error with sub-packages (node_modules)... Can't load the nested package.json

Expected Behavior

the output of the documentation or splitting the project to have the documentation of each parts or sub-modules (i.e. sub npm modules)

Actual Behavior

npx typedoc                                                                                                                                                                                                                                                                              

TypeDoc exiting with unexpected error:
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(declaration)

    at convertVariableAsFunction (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:409:5)
    at Object.convertVariable (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:389:16)
    at Object.convertSymbol (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:81:79)
    at Converter.convertExports (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:180:23)
    at Converter.compile (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:156:34)
    at Converter.convert (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:42:14)
    at Application.convert (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/application.js:151:31)
    at run (/home/luxcium/dev/questrade-ts/node_modules/typedoc/bin/typedoc:61:25)
    at Object.<anonymous> (/home/luxcium/dev/questrade-ts/node_modules/typedoc/bin/typedoc:27:1)
    at Module._compile (node:internal/modules/cjs/loader:1108:14) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
npm ERR! code 5
npm ERR! path /home/luxcium/dev/questrade-ts
npm ERR! command failed
npm ERR! command sh -c typedoc

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/luxcium/.npm/_logs/2021-01-08T17_33_27_412Z-debug.log

Steps to reproduce the bug

{
  "entryPoints": [
    "./src"
  ],
  "exclude": [
    "**/node_modules"
  ],
  "out": "./docs"

How you are running TypeDoc + any relevant configuration files

  1. npx typedoc
  2. ./package.json (with yarn install)
  3. ./typedoc.json
  4. ./tsconfig.json
  5. entryPoints": "./src"
  6. subfolder containing an other node_modules folder: /src/resources/side-effects/
  7. ./src/resources/side-effects/package.json (with npm install)

Environment

echo -ne '\ntypedoc --version'; npx typedoc --version; echo -e '\ntsc --version'; npx tsc --version;echo -e '\nnode --version'; node --version; echo -e '\nuname -srvo' ; uname -srvo

  • typedoc --version
    TypeDoc 0.20.13
    Using TypeScript 4.1.3 from /home/luxcium/dev/questrade-ts/node_modules/typescript/lib

  • tsc --version
    Version 4.1.3

  • node --version
    v15.5.1

  • uname -srvo
    Linux 5.9.16-100.fc32.x86_64 Name of commandline tool #1 SMP Mon Dec 21 14:10:00 UTC 2020 GNU/Linux

@Luxcium Luxcium added the bug Functionality does not match expectation label Jan 8, 2021
@Luxcium
Copy link
Author

Luxcium commented Jan 8, 2021

when config does not exclude node_modules:

{
  "entryPoints": [
    "./src"
  ],
  "exclude": [],
  "out": "./docs"
}

using npx typedoc instead give this output:

Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/assert.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/async_hooks.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/base.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/buffer.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/child_process.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/cluster.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/console.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/constants.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/crypto.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/dgram.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/dns.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/domain.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/events.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/fs/promises.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/fs.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/globals.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/globals.global.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/http.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/http2.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/https.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/index.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/inspector.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/module.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/net.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/os.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/path.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/perf_hooks.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/process.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/punycode.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/querystring.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/readline.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/repl.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/stream.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/string_decoder.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/timers.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/tls.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/trace_events.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/ts3.4/assert.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/ts3.4/base.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/ts3.4/globals.global.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/ts3.4/index.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/ts3.6/base.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/ts3.6/index.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/tty.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/url.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/util.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/v8.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/vm.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/wasi.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/worker_threads.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/@types/node/zlib.d.ts
Warning: Unable to locate entry point: /home/luxcium/dev/questrade-ts/src/resources/side-effects/node_modules/dotenv/types/test.ts
TypeDoc exiting with unexpected error:
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(declaration)

    at convertVariableAsFunction (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:409:5)
    at Object.convertVariable (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:389:16)
    at Object.convertSymbol (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:81:79)
    at Converter.convertExports (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:180:23)
    at Converter.compile (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:156:34)
    at Converter.convert (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:42:14)
    at Application.convert (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/application.js:151:31)
    at run (/home/luxcium/dev/questrade-ts/node_modules/typedoc/bin/typedoc:61:25)
    at Object.<anonymous> (/home/luxcium/dev/questrade-ts/node_modules/typedoc/bin/typedoc:27:1)
    at Module._compile (node:internal/modules/cjs/loader:1108:14) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
} 
npm ERR! code 5
npm ERR! path /home/luxcium/dev/questrade-ts
npm ERR! command failed
npm ERR! command sh -c typedoc

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/luxcium/.npm/_logs/2021-01-08T18_08_45_116Z-debug.log 

@Luxcium
Copy link
Author

Luxcium commented Jan 8, 2021

when config exclude the folder **/src/resources/side-effects/**

{
  "entryPoints": [
    "./src"
  ],
  "exclude": [
    "**/src/resources/side-effects/**"
  ],
  "out": "./docs"
}

using npx typedoc then give this output:

Warning: Failed to convert type node with kind: OptionalType and text Leg?. Please report a bug.
        /home/luxcium/dev/questrade-ts/src/typescript/IStrategiesVariants.ts:15:24
Warning: Failed to convert type node with kind: OptionalType and text Leg?. Please report a bug.
        /home/luxcium/dev/questrade-ts/src/typescript/IStrategiesVariants.ts:15:30
Warning: Failed to convert type node with kind: OptionalType and text Leg?. Please report a bug.
        /home/luxcium/dev/questrade-ts/src/typescript/IStrategiesVariants.ts:15:36
TypeDoc exiting with unexpected error:
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(declaration)

    at convertVariableAsFunction (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:409:5)
    at Object.convertVariable (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:389:16)
    at convertSymbol (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:81:79)
    at Object.convertAlias (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:371:9)
    at Object.convertSymbol (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/symbols.js:81:79)
    at Converter.convertExports (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:180:23)
    at Converter.compile (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:156:34)
    at Converter.convert (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/converter/converter.js:42:14)
    at Application.convert (/home/luxcium/dev/questrade-ts/node_modules/typedoc/dist/lib/application.js:151:31)
    at run (/home/luxcium/dev/questrade-ts/node_modules/typedoc/bin/typedoc:61:25) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
npm ERR! code 5
npm ERR! path /home/luxcium/dev/questrade-ts
npm ERR! command failed
npm ERR! command sh -c typedoc

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/luxcium/.npm/_logs/2021-01-08T18_11_59_955Z-debug.log

@Luxcium
Copy link
Author

Luxcium commented Jan 8, 2021

{
  "entryPoints": [
    "./src"
  ],
  "exclude": [
    "./src/resources"
  ],
  "out": "./docs"
}
npm ERR! code 5
npm ERR! path /home/luxcium/dev/questrade-ts
npm ERR! command failed
npm ERR! command sh -c typedoc

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/luxcium/.npm/_logs/2021-01-08T18_15_03_709Z-debug.log

output of cat /home/luxcium/.npm/_logs/2021-01-08T18_15_03_709Z-debug.log:

0 verbose cli [
0 verbose cli   '/home/luxcium/.fnm/node-versions/v15.5.1/installation/bin/node',
0 verbose cli   '/home/luxcium/.fnm/node-versions/v15.5.1/installation/lib/node_modules/npm/bin/npm-cli.js',
0 verbose cli   'exec',
0 verbose cli   '--',
0 verbose cli   'typedoc'
0 verbose cli ]
1 info using npm@7.3.0
2 info using node@v15.5.1
3 timing config:load:defaults Completed in 0ms
4 timing config:load:file:/home/luxcium/.fnm/node-versions/v15.5.1/installation/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 0ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:/home/luxcium/dev/questrade-ts/.npmrc Completed in 1ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/home/luxcium/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/home/luxcium/.fnm/node-versions/v15.5.1/installation/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 4ms
19 verbose npm-session 2d66e5cc424c8660
20 timing npm:load Completed in 9ms
21 timing command:exec Completed in 4052ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> (/home/luxcium/.fnm/node-versions/v15.5.1/installation/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
22 verbose stack     at ChildProcess.emit (node:events:376:20)
22 verbose stack     at maybeClose (node:internal/child_process:1063:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
23 verbose pkgid questrade-ts@1.2.0-next
24 verbose cwd /home/luxcium/dev/questrade-ts
25 verbose Linux 5.9.16-100.fc32.x86_64
26 verbose argv "/home/luxcium/.fnm/node-versions/v15.5.1/installation/bin/node" "/home/luxcium/.fnm/node-versions/v15.5.1/installation/lib/node_modules/npm/bin/npm-cli.js" "exec" "--" "typedoc"
27 verbose node v15.5.1
28 verbose npm  v7.3.0
29 error code 5
30 error path /home/luxcium/dev/questrade-ts
31 error command failed
32 error command sh -c typedoc
33 verbose exit 5

@Gerrit0 Gerrit0 closed this as completed in f373302 Jan 9, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 9, 2021

So... there are a few problems here.

  1. I'm not sure you understand how entryPoints works... You almost certainly should not be giving TypeDoc the src directory.
    When you give TypeDoc a directory as an entry point it will recursively expand that directory, getting every ts, tsx (and maybe .js, if you set allowJs) file within it, except those you specify with exclude.

    The expanded entry points will then be used to document your library's exports. With a quick look at your project, it looks like you have two entry points - src/index.ts and src/types.ts. Unless you expect users to be able to import from every file under src directly, it shouldn't be the entry point... but your first command should have worked in the first place - it does now.

  2. Optional types weren't converted properly:

    Warning: Failed to convert type node with kind: OptionalType and text Leg?. Please report a bug.
            /home/luxcium/dev/questrade-ts/src/typescript/IStrategiesVariants.ts:15:24
    

    Fixed in 0.20.14

  3. The "export destructured object" pattern used in default-behavior.tsx is really weird and something that wasn't considered when creating the converter. This is what is causing the crash - fixed in 0.20.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants