loadtest icon indicating copy to clipboard operation
loadtest copied to clipboard

docs outdated?

Open pquerner opened this issue 1 year ago • 4 comments

Hey,

wanted to try this to test how a API endpoint behaves under load, so I began reading some docs and reading some files. I found this one puzzling:

https://github.com/alexfernandez/loadtest/blob/main/doc/api.md#start-test-server

To start the test server use the exported function startServer() with a set of options:

import {startServer} from 'loadtest'
const server = await startServer({port: 8000})
// do your thing
await server.close()

but for me loadtest does not give such function. I've installed 8.0.9.

Then I tried following https://github.com/alexfernandez/loadtest/blob/main/test/body-generator.js however, this used the startServer differently as shown in the docs. Because this test folder sits directly next to the library.

Soo.. what am I to do?

pquerner avatar May 11 '24 16:05 pquerner

You should definitely have a startServer() function, it's exported. What functions do you have exported?

alexfernandez avatar May 11 '24 17:05 alexfernandez

Its not visible in index.d.ts, maybe thats why? I see it exported in the index.js file, but would that work for a .ts file? It doesnt know that?

pquerner avatar May 11 '24 17:05 pquerner

Oh, you are right! I don't use TypeScript so I have not found this issue. Care to send a patch to update index.d.ts?

alexfernandez avatar May 11 '24 18:05 alexfernandez

Mh I dont really know how. I will investigate if I do this right. Maybe some other typescript user here? ^^

I tried npx -p typescript tsc lib/**/*.js --declaration --allowJs --emitDeclarationOnly --outFile index.d.ts but the git diff is really scary big.

diff.txt

from: https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html

pquerner avatar May 11 '24 18:05 pquerner