Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Jest preset for Redis in-memory server
$ yarn add redis-memory-server jest-redis --dev
jest.config.js
filemodule.exports = {
preset: 'jest-redis',
}
jest-redis.config.js
See redis-memory-server to learn more about the optional configuraitons.
module.exports = {
redisMemoryServerOptions: {
instance: {
port: number, // by default, choose any free port
ip: string, // by default, '127.0.0.1'; for binding to all IP addresses set it to `::,0.0.0.0`,
args: [], // by default, no additional arguments; any additional command line arguments for `redis-server`
},
binary: {
version: string, // by default, 'stable'
downloadDir: string, // by default, 'node_modules/.cache/redis-memory-server/redis-binaries'
systemBinary: string, // by default, undefined
},
autoStart: boolean, // by default, true
},
useSharedDBForAllJestWorkers: boolean, // enables seperated database for each test worker. This disables the exported environment variable.
redisURLEnvName: string, // the exported environment variable name
}
This library sets the process.env[options.redisURLEnvName]
(by default process.env.REDIS_URL
) for your convenience. However, it's preferable to use global.__REDIS_URL__
as is works with useSharedDBForAllJestWorkers
.
const Redis = require('ioredis')
describe('set', () => {
let client
beforeAll(async () => {
client = new Redis(global.__REDIS_URL__)
await client.connect()
})
afterAll(async () => {
await client.disconnect()
})
})
This package creates the file redisGlobals.json
in the project root when using jest --watch
flag. Changes to this file can cause issues.
In order to avoid unwanted behaviour, add the redisGlobals.json
to your ignore files and in jest.config.js
, add:
// jest.config.js
module.exports = {
watchPathIgnorePatterns: ['redisGlobals']
}
FAQs
Jest preset for Redis in-memory server
The npm package jest-redis receives a total of 74 weekly downloads. As such, jest-redis popularity was classified as not popular.
We found that jest-redis 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.