-
Notifications
You must be signed in to change notification settings - Fork 7
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
indexer: add vcr integration with vitest #82
Conversation
fe34972
to
d25cbeb
Compare
d25cbeb
to
add7d95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think we need to add some missing extends Record<string, unknown>
or I get type errors.
I will add a PR to add proper type checking before build.
packages/indexer/package.json
Outdated
@@ -29,6 +29,11 @@ | |||
"types": "./dist/sinks/csv.d.ts", | |||
"import": "./dist/sinks/csv.mjs", | |||
"default": "./dist/sinks/csv.mjs" | |||
}, | |||
"./sinks/vcr": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add the export to the "exports"
section abev too.
packages/indexer/src/tests/index.ts
Outdated
@@ -0,0 +1 @@ | |||
export * from "./setup"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the folder to testing
, then export it from package.json
as ./testing
. That way users will be able to import the functions as @apibara/indexer/testing
.
packages/indexer/src/sinks/vcr.ts
Outdated
@@ -0,0 +1,16 @@ | |||
import { Sink, type SinkWriteArgs } from "../sink"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sink should be in the testing
module since it's never used outside of testing.
add7d95
to
be3f207
Compare
eede9e6
to
19bf58d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
extends
vitest
context withvcr
allowing user to use recorded streams for writing tests.