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

chore: Fix InjectOptions type with test additions #281

Conversation

thierrymarianne
Copy link
Contributor

@thierrymarianne thierrymarianne commented Feb 23, 2024

Description

Hello!

I've noticed that autoStart does not appear in InjectOptions type.

  • autoStart has been added as a boolean
  • tests added for both autoStart and validate (boolean as well)

Checklist

Tests:

npm test

> light-my-request@5.11.0 test
> npm run lint && npm run test:unit && npm run test:typescript


> light-my-request@5.11.0 lint
> standard


> light-my-request@5.11.0 test:unit
> tap

 PASS ​ test/response.test.js 1 OK 4.565ms
 PASS ​ test/request.test.js 1 OK 7.109ms
 PASS ​ test/async-await.test.js 4 OK 32.416ms
 PASS ​ test/index.test.js 281 OK 246.504ms



  🌈 SUMMARY RESULTS 🌈


Suites:   ​4 passed​, ​4 of 4 completed​
Asserts:  ​​​287 passed​, ​of 287​
Time:​   ​521.899ms​
----------------------|---------|----------|---------|---------|-------------------
File                  | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------------------|---------|----------|---------|---------|-------------------
All files             |     100 |      100 |     100 |     100 |
 light-my-request     |     100 |      100 |     100 |     100 |
  index.js            |     100 |      100 |     100 |     100 |
 light-my-request/lib |     100 |      100 |     100 |     100 |
  parse-url.js        |     100 |      100 |     100 |     100 |
  request.js          |     100 |      100 |     100 |     100 |
  response.js         |     100 |      100 |     100 |     100 |
----------------------|---------|----------|---------|---------|-------------------

> light-my-request@5.11.0 test:typescript
> tsd

Benchmark:

npm run benchmark

> light-my-request@5.11.0 benchmark
> node benchmark/benchmark.js

┌─────────┬──────────────────────────────────┬─────────────┬────────────────────┬───────────┬─────────┐
│ (index) │ Task Name                        │ ops/sec     │ Average Time (ns)  │ Margin    │ Samples │
├─────────┼──────────────────────────────────┼─────────────┼────────────────────┼───────────┼─────────┤
│ 0       │ 'Request'                        │ '799,452'   │ 1250.8561243045604 │ '±1.84%'  │ 399727  │
│ 1       │ 'Custom Request'                 │ '64,595'    │ 15480.85259149168  │ '±1.91%'  │ 32298   │
│ 2       │ 'Request With Cookies'           │ '492,454'   │ 2030.6429852903127 │ '±6.78%'  │ 246368  │
│ 3       │ 'Request With Cookies n payload' │ '586,594'   │ 1704.7546386269912 │ '±0.96%'  │ 293298  │
│ 4       │ 'ParseUrl'                       │ '2,389,541' │ 418.4902973036068  │ '±0.24%'  │ 1194771 │
│ 5       │ 'ParseUrl and query'             │ '251,974'   │ 3968.6591183286455 │ '±0.35%'  │ 125988  │
│ 6       │ 'read request body JSON'         │ '59,306'    │ 16861.64787212543  │ '±0.50%'  │ 29654   │
│ 7       │ 'read request body buffer'       │ '64,108'    │ 15598.663422243855 │ '±0.35%'  │ 32055   │
│ 8       │ 'read request body readable'     │ '52,860'    │ 18917.78082554536  │ '±0.82%'  │ 26431   │
│ 9       │ 'Response write end'             │ '91,987'    │ 10870.983563072667 │ '±11.96%' │ 45994   │
│ 10      │ 'Response writeHead end'         │ '68,895'    │ 14514.63281024087  │ '±40.83%' │ 34538   │
│ 11      │ 'base inject'                    │ '19,952'    │ 50119.469701510636 │ '±31.62%' │ 10017   │
└─────────┴──────────────────────────────────┴─────────────┴────────────────────┴───────────┴─────────┘

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 9a7d3dc into fastify:master Feb 23, 2024
19 checks passed
@thierrymarianne thierrymarianne deleted the add-autoStart-field-to-InjectOptions-interface branch February 23, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants