stack-auth / pgmock Goto Github PK
View Code? Open in Web Editor NEWIn-memory Postgres for unit/E2E tests
Home Page: https://stackframe-projects.github.io/pgmock/
License: MIT License
In-memory Postgres for unit/E2E tests
Home Page: https://stackframe-projects.github.io/pgmock/
License: MIT License
as per title
Currently, migration took about 20-30 seconds which is too slow for testing.
We also need to reset db after each test so 20-30 seconds wait time between each tests is not viable.
We need a solution for this, so we can bring it down to sub 1 second.
Right now, the only documentation is the docstrings in the source code. I should generate a webpage from those
As reported here, when pgmock is unhappy with a SQL query it throws an unexpected error instead of showing the details:
select foo();
Error.captureStackTrace is not a function
Fortunately, @rezonant was quickly able to explain the likely problem (this is a Firefox specific issue), which should help get this fixed:
Yes, that's a nonstandard function provided by v8, so it wouldn't work on Firefox. [1]
This can be worked around by just constructing an Error and taking it's stack property,
captureStackTrace is just a convenience function, so hopefully they can fix that.
Thanks for publishing this!
The README links to the URL https://github.com/supabase/postgres-wasm for "Supabase & Snaplet", but that link currently 404s.
Hey ๐ ,
I'm one of the developers who worked on https://github.com/snaplet/postgres-wasm, I'm super happy to see that our work helped and that you were able to pull this off to make it usable! I added a shoutout to this project in the README. ๐
I see that you wrote an entire network adapter for it which I suppose is at the emulator level, so I'm wondering how hard it would be to have MySQL running in the browser now.
Again, congrats, mad work!
Currently, you can install plugins with runShellCommand
, but this is needlessly difficult and unhandy.
When trying to run:
create extension if not exists "uuid-ossp";
it fails with
error: could not open extension control file "/usr/share/postgresql/extension/uuid-ossp.control": No such file or directory
at <anonymous> (/Users/scott/project/node_modules/pg/lib/client.js:526:17)
Is this meant to be supported? Or is there a specific process to get extensions working?
Cool project!
Has anyone seen similar Mysql/MariaDB alternative?
Looking for simple in-memory innoDB implementation.
The link to the demo / GitHub pages link gives a 404 / page not found.
I'm trying to add pgmock in our E2E testing suite using NestJS, TypeORM + Jest.
I get the following error thrown though:
Unhandled Rejection at: Promise {
<rejected> TypeError: Cannot read properties of undefined (reading '0')
at Object.<anonymous>.r.Bitmap.get (/<REDACTED>/node_modules/pgmock/dist/main.js:3039:25)
at E.Object.<anonymous>.E.unpack_memory (/<REDACTED>/node_modules/pgmock/dist/main.js:10548:19)
at E.Object.<anonymous>.E.set_state (/<REDACTED>/node_modules/pgmock/dist/main.js:10491:14)
at E.Object.<anonymous>.E.restore_state (/<REDACTED>/node_modules/pgmock/dist/main.js:8124:18)
at D.Object.<anonymous>.D.restore_state (/<REDACTED>/node_modules/pgmock/dist/main.js:2881:25)
at Y.d (/<REDACTED>/node_modules/pgmock/dist/main.js:12413:35)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7)
} reason: TypeError: Cannot read properties of undefined (reading '0')
at Object.<anonymous>.r.Bitmap.get (/<REDACTED>/node_modules/pgmock/dist/main.js:3039:25)
at E.Object.<anonymous>.E.unpack_memory (/<REDACTED>/node_modules/pgmock/dist/main.js:10548:19)
at E.Object.<anonymous>.E.set_state (/<REDACTED>/node_modules/pgmock/dist/main.js:10491:14)
at E.Object.<anonymous>.E.restore_state (/<REDACTED>/node_modules/pgmock/dist/main.js:8124:18)
at D.Object.<anonymous>.D.restore_state (/<REDACTED>/node_modules/pgmock/dist/main.js:2881:25)
at Y.d (/<REDACTED>/node_modules/pgmock/dist/main.js:12413:35)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7)
...
RangeError: Maximum call stack size exceeded
at _ZN3v863cpu3cpu12do_page_walk17h3226b305185b420aE (wasm:/wasm/0060a6c6:1:471691)
at _ZN3v863cpu3cpu21call_interrupt_vector17h15f125d3196b6ae5E (wasm:/wasm/0060a6c6:1:734657)
at _ZN3v863cpu3cpu12do_page_walk17h3226b305185b420aE (wasm:/wasm/0060a6c6:1:472412)
at _ZN3v863cpu3cpu21call_interrupt_vector17h15f125d3196b6ae5E (wasm:/wasm/0060a6c6:1:734657)
at _ZN3v863cpu3cpu12do_page_walk17h3226b305185b420aE (wasm:/wasm/0060a6c6:1:472412)
at _ZN3v863cpu3cpu21call_interrupt_vector17h15f125d3196b6ae5E (wasm:/wasm/0060a6c6:1:734657)
at _ZN3v863cpu3cpu12do_page_walk17h3226b305185b420aE (wasm:/wasm/0060a6c6:1:472412)
at _ZN3v863cpu3cpu21call_interrupt_vector17h15f125d3196b6ae5E (wasm:/wasm/0060a6c6:1:734657)
at _ZN3v863cpu3cpu12do_page_walk17h3226b305185b420aE (wasm:/wasm/0060a6c6:1:472412)
at _ZN3v863cpu3cpu21call_interrupt_vector17h15f125d3196b6ae5E (wasm:/wasm/0060a6c6:1:734657)
at _ZN3v863cpu3cpu12do_page_walk17h3226b305185b420aE (wasm:/wasm/0060a6c6:1:472412)
at _ZN3v863cpu3cpu21call_interrupt_vector17h15f125d3196b6ae5E (wasm:/wasm/0060a6c6:1:734657)
at _ZN3v863cpu3cpu12do_page_walk17h3226b305185b420aE (wasm:/wasm/0060a6c6:1:472412)
Any ideas what this might indicate?
no amount of transform ignore stuff seems to work
is there a standard way? i just get this:
import nodecrypto from "crypto";
^^^^^^
SyntaxError: Cannot use import statement outside a module
Jest work for cjs as default, if pgmock support cjs, it will easier to use.
How would I add pg extensions, e.g. pgvector, to pgmock? I see the binaries folder and assume that's where the secret source is. It would be nice if there were documentation on how to generate them, or even better, a script. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.