Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
typeorm-transactional-tests
Advanced tools
[![Travis](https://app.travis-ci.com/viniciusjssouza/typeorm-transactional-tests.svg?branch=master&status=passed)](https://app.travis-ci.com/github/viniciusjssouza/typeorm-transactional-tests) [![Coverage Status](https://coveralls.io/repos/github/vinicius
TypeORM does not provide builtin transactional tests. If your tests write to a non in-memory database, probably you have to truncate or erase all your tables for every test case.
This package allows the creation of transactional contexts during the test, starting a transaction in the begining of the test and rolling back at the end. This is a faster solution than truncate/delete, once nothing is really written to disk.
npm install --save-dev typeorm-transactional-tests
Versions 1.x.x of this library is compatible with typeorm 0.2.x
Versions 2.x.x of this library is compatible with typeorm 0.3.x
To apply the transactional context with Jest, just start the context in an beforeEach
block and finish it in an afterEach
:
import {Connection, getConnection } from 'typeorm';
import { TransactionalTestContext } from 'typeorm-transactional-tests';
let connection: Connection;
let transactionalContext: TransactionalTestContext;
beforeEach(async () => {
connection = getConnection();
transactionalContext = new TransactionalTestContext(connection);
await transactionalContext.start();
});
afterEach(async () => {
await transactionalContext.finish();
});
Also, it is possible to apply the context to all your tests using a global Jest setup file. Add a new file on your test folder:
import TransactionalTestContext from 'typeorm-transactional-tests'
// @ts-ignore
global.beforeEach(async () => await transactionalContext.start());
// @ts-ignore
global.afterEach(async () => await transactionalContext.finish());
And point the Jest configuration to it:
"setupFilesAfterEnv": [
"<rootDir>/test/support/transactionalContext.ts"
]
FAQs
[![Travis](https://app.travis-ci.com/viniciusjssouza/typeorm-transactional-tests.svg?branch=master&status=passed)](https://app.travis-ci.com/github/viniciusjssouza/typeorm-transactional-tests) [![Coverage Status](https://coveralls.io/repos/github/vinicius
The npm package typeorm-transactional-tests receives a total of 25,703 weekly downloads. As such, typeorm-transactional-tests popularity was classified as popular.
We found that typeorm-transactional-tests demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.