dwyl / hapi-auth-jwt2

:lock: Secure Hapi.js authentication plugin using JSON Web Tokens (JWT) in Headers, URL or Cookies
ISC License
798 stars 126 forks source link

Chore: Replace `tape` with `tap` in tests #432

Open nelsonic opened 1 year ago

nelsonic commented 1 year ago

All the @dependabot PRs attempting to update tape https://www.npmjs.com/package/tape (the testing library) fail because tape made a few (totally unnecessary) breaking changes ... tap https://www.npmjs.com/package/tap a less popular but similar functionality alternative has not made those changes.

Todo

See: https://github.com/dwyl/aws-sdk-mock/pull/322 which updates tap without any issues. ✅

nelsonic commented 1 year ago

Tests pass but eslint doesn't ...

TypeError: prettier.resolveConfig.sync is not a function
Occurred while linting /hapi-auth-jwt2/lib/extract.js:1
Rule: "prettier/prettier"
    at Program (/hapi-auth-jwt2/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js:138:40)
    at ruleErrorHandler (/hapi-auth-jwt2/node_modules/eslint/lib/linter/linter.js:1091:28)
    at /hapi-auth-jwt2/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/hapi-auth-jwt2/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/hapi-auth-jwt2/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/hapi-auth-jwt2/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/hapi-auth-jwt2/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (/hapi-auth-jwt2/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:803:23)
    at /hapi-auth-jwt2/node_modules/eslint/lib/linter/linter.js:1126:32

🤦‍♂️

nelsonic commented 1 year ago

Tried updating a couple of test files from tape to tap on a @dependabot PR that was failing: https://github.com/dwyl/hapi-auth-jwt2/pull/427

The response.statusCode changed from 401 to 404 on a couple of tests where the server didn't change at all. This is very weird. Not got time to be spending on this right now. If anyone else wants to help with migrating from tape to tap, please dive in! 🙏