AngelaE / ts-mountebank

Mountebank client for TS / node
15 stars 5 forks source link

Update devbox tools and pnpm #36

Open yeongsheng-tan opened 2 months ago

yeongsheng-tan commented 2 months ago
  1. Update nodejs 20 to latest minor and patch fix version
  2. Update typescript to 5.5.4
  3. Update pnpm to 9.11.0
  4. Update devbox to 0.13.0
  5. Enable direnv integration with devbox to make the development experience closer to buttery smooth
  6. update development node packages to pull in latest vulnerability fixes
AngelaE commented 1 month ago

Apologies for taking so long to look at this. The package updates look good, thanks! But for some reason the devbox seems to terminate whenever the tests had an error, and now the terminal has stopped working completely. I'll call it a day and restart my laptop and get back to it later.

yeongsheng-tan commented 1 month ago

Apologies for taking so long to look at this. The package updates look good, thanks! But for some reason the devbox seems to terminate whenever the tests had an error, and now the terminal has stopped working completely. I'll call it a day and restart my laptop and get back to it later.

Could you reproduce the failing test so I can try locally and check what causes the devbox jettison, resulting in your terminal completely not working?

AngelaE commented 1 month ago

Apologies for taking so long to look at this. The package updates look good, thanks! But for some reason the devbox seems to terminate whenever the tests had an error, and now the terminal has stopped working completely. I'll call it a day and restart my laptop and get back to it later.

Could you reproduce the failing test so I can try locally and check what causes the devbox jettison, resulting in your terminal completely not working?

After the re-start my terminal is working again. Maybe everything ran out of memory or so? And now my devbox does not exit anymore after the test fails!

I am running as follows:

I have one of the integration tests failing locally, but think this may have been the case previously as well.

[test:ci:wait-and-test]   1) Mountebank
[test:ci:wait-and-test]        can delete an imposter:
[test:ci:wait-and-test]      AssertionError: expected undefined to match /(?:ECONNREFUSED|ECONNRESET)/
[test:ci:wait-and-test]       at Context.<anonymous> (dist/mountebank.test.js:56:53)
[test:ci:wait-and-test]       at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 
yeongsheng-tan commented 1 month ago

Apologies for taking so long to look at this. The package updates look good, thanks! But for some reason the devbox seems to terminate whenever the tests had an error, and now the terminal has stopped working completely. I'll call it a day and restart my laptop and get back to it later.

Could you reproduce the failing test so I can try locally and check what causes the devbox jettison, resulting in your terminal completely not working?

After the re-start my terminal is working again. Maybe everything ran out of memory or so? And now my devbox does not exit anymore after the test fails!

I am running as follows:

* windows, with WSL installed

* VSCode with the devbox extension

* When I open a WSL terminal in VSCode devbox is started automatically.

I have one of the integration tests failing locally, but think this may have been the case previously as well.

[test:ci:wait-and-test]   1) Mountebank
[test:ci:wait-and-test]        can delete an imposter:
[test:ci:wait-and-test]      AssertionError: expected undefined to match /(?:ECONNREFUSED|ECONNRESET)/
[test:ci:wait-and-test]       at Context.<anonymous> (dist/mountebank.test.js:56:53)
[test:ci:wait-and-test]       at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 

Do I presume from root of ts-mountebank checked-out source code, you ran pnpm test:integration and you got the above results?

Could you instead try with pnpm recursive i && pnpm test:integration and see what happens?

This is how mine looks:

❯ pnpm recursive i && pnpm test:integration
Scope: all 3 workspace projects
Lockfile is up to date, resolution step is skipped
. prepare$ husky
└─ Done in 210ms
Done in 527ms

> mb-helper@1.0.0 test:integration /Users/yeongshengtan/code_repos/hobby/ts-mountebank
> pnpm -C integration-tests test:ci

> @anev/ts-mountebank-tests@1.0.0 test:ci /Users/yeongshengtan/code_repos/hobby/ts-mountebank/integration-tests
> run-p -clnr start:mb test:ci:wait-and-test

[start:mb             ]
[start:mb             ] > @anev/ts-mountebank-tests@1.0.0 start:mb /Users/yeongshengtan/code_repos/hobby/ts-mountebank/integration-tests/package.json
[start:mb             ] > mb
[start:mb             ]
[test:ci:wait-and-test]
[test:ci:wait-and-test] > @anev/ts-mountebank-tests@1.0.0 test:ci:wait-and-test /Users/yeongshengtan/code_repos/hobby/ts-mountebank/integration-tests/package.json
[test:ci:wait-and-test] > wait-on tcp:2525 && mocha --recursive --forbid-only ./dist
[test:ci:wait-and-test]
[test:ci:wait-and-test]
[test:ci:wait-and-test] > @anev/ts-mountebank-tests@1.0.0 test:ci:wait-and-test /Users/yeongshengtan/code_repos/hobby/ts-mountebank/integration-tests
[test:ci:wait-and-test] > wait-on tcp:2525 && mocha --recursive --forbid-only ./dist
[test:ci:wait-and-test]
[start:mb             ]
[start:mb             ] > @anev/ts-mountebank-tests@1.0.0 start:mb /Users/yeongshengtan/code_repos/hobby/ts-mountebank/integration-tests
[start:mb             ] > mb
[start:mb             ]
[start:mb             ] info: [mb:2525] mountebank v2.9.1 now taking orders - point your browser to http://localhost:2525/ for help
[test:ci:wait-and-test]
[test:ci:wait-and-test]
[test:ci:wait-and-test]   Imposter
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12345] ::1:53206 => GET /testpath
[start:mb             ] info: [mb:2525] GET /imposters/12345
[test:ci:wait-and-test] {
[test:ci:wait-and-test]   protocol: 'http',
[test:ci:wait-and-test]   port: 12345,
[test:ci:wait-and-test]   numberOfRequests: 1,
[test:ci:wait-and-test]   recordRequests: true,
[test:ci:wait-and-test]   requests: [
[test:ci:wait-and-test]     {
[test:ci:wait-and-test]       requestFrom: '::1:53206',
[test:ci:wait-and-test]       method: 'GET',
[test:ci:wait-and-test]       path: '/testpath',
[test:ci:wait-and-test]       query: {},
[test:ci:wait-and-test]       headers: [Object],
[test:ci:wait-and-test]       body: '',
[test:ci:wait-and-test]       ip: '::1',
[test:ci:wait-and-test]       timestamp: '2024-09-23T06:59:20.919Z'
[test:ci:wait-and-test]     }
[test:ci:wait-and-test]   ],
[test:ci:wait-and-test]   stubs: [ { predicates: [Array], responses: [Array], _links: [Object] } ],
[test:ci:wait-and-test]   _links: {
[test:ci:wait-and-test]     self: { href: 'http://localhost:2525/imposters/12345' },
[test:ci:wait-and-test]     stubs: { href: 'http://localhost:2525/imposters/12345/stubs' }
[test:ci:wait-and-test]   }
[test:ci:wait-and-test] }
[test:ci:wait-and-test]     ✔ can record requests
[test:ci:wait-and-test]
[test:ci:wait-and-test]   Mountebank
[start:mb             ] info: [mb:2525] GET /
[test:ci:wait-and-test]     ✔ is running
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12345] ::1:53211 => GET /testpath
[test:ci:wait-and-test]     ✔ can create an imposter
[start:mb             ] info: [mb:2525] GET /imposters/12345
[test:ci:wait-and-test]     ✔ can query an imposter
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[test:ci:wait-and-test]     ✔ can delete an imposter
[test:ci:wait-and-test]
[test:ci:wait-and-test]   The flexi predicate works with query
[test:ci:wait-and-test]     Body works for predicate '{"name":"x","max":5}'
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12345] ::1:53218 => POST /testpath
[test:ci:wait-and-test]       ✔ works with match '{"name":"x","max":5}'
[start:mb             ] info: [http:12345] ::1:53219 => POST /testpath
[test:ci:wait-and-test]       ✔ works with match '{"name":"x","max":5,"min":1}'
[start:mb             ] info: [http:12345] ::1:53220 => POST /testpath
[start:mb             ] info: [http:12345] no predicate match, using default response
[test:ci:wait-and-test]       ✔ does not work with '{"name":"x"}'
[start:mb             ] info: [http:12345] ::1:53221 => POST /testpath
[start:mb             ] info: [http:12345] no predicate match, using default response
[test:ci:wait-and-test]       ✔ does not work with '{"name":"x","max":6}'
[test:ci:wait-and-test]
[test:ci:wait-and-test]   The flexi predicate works with path
[test:ci:wait-and-test]     startsWith Operator with path '/test'
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12345] ::1:53224 => GET /testpath
[test:ci:wait-and-test]       ✔ works with match '/testpath'
[start:mb             ] info: [http:12345] ::1:53225 => GET /te
[start:mb             ] info: [http:12345] no predicate match, using default response
[test:ci:wait-and-test]       ✔ does not work with '/te'
[test:ci:wait-and-test]     endsWith Operator with path 'ong'
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12345] ::1:53228 => GET /testpath-long
[test:ci:wait-and-test]       ✔ works with match '/testpath-long'
[start:mb             ] info: [http:12345] ::1:53229 => GET /testing
[start:mb             ] info: [http:12345] no predicate match, using default response
[test:ci:wait-and-test]       ✔ does not work with '/testing'
[test:ci:wait-and-test]
[test:ci:wait-and-test]   The flexi predicate works with query
[test:ci:wait-and-test]     Query works for predicate '{"name":"x","max":5}'
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12345] ::1:53232 => GET /testpath?name=x&max=5
[test:ci:wait-and-test]       ✔ works with match 'name=x&max=5'
[start:mb             ] info: [http:12345] ::1:53233 => GET /testpath?max=5&name=x
[test:ci:wait-and-test]       ✔ works with match 'max=5&name=x'
[start:mb             ] info: [http:12345] ::1:53234 => GET /testpath?MAX=5&namE=X
[test:ci:wait-and-test]       ✔ works with match 'MAX=5&namE=X'
[start:mb             ] info: [http:12345] ::1:53235 => GET /testpath?name=x&max=5&another=y
[test:ci:wait-and-test]       ✔ works with match 'name=x&max=5&another=y'
[start:mb             ] info: [http:12345] ::1:53236 => GET /testpath?max=5
[start:mb             ] info: [http:12345] no predicate match, using default response
[test:ci:wait-and-test]       ✔ does not work with 'max=5'
[start:mb             ] info: [http:12345] ::1:53237 => GET /testpath?name=x&max=6
[start:mb             ] info: [http:12345] no predicate match, using default response
[test:ci:wait-and-test]       ✔ does not work with 'name=x&max=6'
[test:ci:wait-and-test]
[test:ci:wait-and-test]   Proxy
[test:ci:wait-and-test]     Proxies work in Mountebank
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [mb:2525] DELETE /imposters/12346
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12346] Open for business...
[start:mb             ] info: [http:12346] ::1:53242 => GET /testpath
[start:mb             ] info: [http:12345] ::1:53243 => GET /testpath
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12346] ::1:53246 => GET /testpath
[start:mb             ] info: [http:12345] ::1:53247 => GET /testpath
[test:ci:wait-and-test]       ✔ can create a debug proxy for mode proxyAlways
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [mb:2525] DELETE /imposters/12346
[start:mb             ] info: [http:12346] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12346] Open for business...
[start:mb             ] info: [http:12346] ::1:53252 => GET /testpath
[start:mb             ] info: [http:12345] ::1:53253 => GET /testpath
[start:mb             ] info: [mb:2525] DELETE /imposters/12345
[start:mb             ] info: [http:12345] Ciao for now
[start:mb             ] info: [mb:2525] POST /imposters
[start:mb             ] info: [http:12345] Open for business...
[start:mb             ] info: [http:12346] ::1:53256 => GET /testpath
[test:ci:wait-and-test]       ✔ can create a debug proxy for mode proxyOnce
[test:ci:wait-and-test]
[test:ci:wait-and-test]
[test:ci:wait-and-test]   21 passing (88ms)
[test:ci:wait-and-test]
[start:mb             ] info: [mb:2525] Adios - see you soon?