Giter VIP home page Giter VIP logo

fastypest's Introduction

FASTYPEST

GitHub commit activity Github Last Commit GitHub package.json version npm npm peer dependency version Package License NPM Downloads

Buy Me A Coffee

With this library, you can run your test suites without having to stop and restore the database in between them.

Currently compatible with:

  • MySQL >= v5.7 supported
  • MariaDB >= v10.0 supported
  • Postgres >= v9.0 supported
  • cockroachDB >= v22.2.0 supported

If you need compatibility with another database, you can request it here.

Install with npm

npm i -D fastypest

To use it, you must have inserted all the seeds beforehand, and before starting the tests, you must initialize it by indicating the typeorm connection configuration. You must execute restoreData after each test, so that the database is returned to its initial state.

Example of use with jest

Note (I recommend using it in a setupFilesAfterEnv file):

beforeAll(async () => {
  fastypest = new Fastypest(connection);
  await fastypest.init();
});

afterEach(async () => {
  await fastypest.restoreData();
});

fastypest's People

Contributors

dependabot[bot] avatar juanjogondev avatar j-testdev avatar

Stargazers

ansien avatar Jose Alberto Galera Sánchez avatar

Watchers

 avatar  avatar

fastypest's Issues

Restore data issues

Should be from 1 not from 0 SELECT COALESCE(MAX(id), 1) FROM "XXX"))
Secondly not all tables have id column

install fails when in a subproject of a monorepo

hi, i used this tool in my monorepo with a vuejs /frontend project and a nestjs /backend project. now trying to install fastypest in my /backend fails, because .git only exists on folder top:

» » npm i -D fastypest
npm error code 1
npm error path /.../backend/node_modules/fastypest
npm error command failed
npm error command sh -c husky install
npm error husky - .git can't be found (see https://typicode.github.io/husky/#/?id=custom-directory)

why wants this project now to install husky for pre-commits?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.