Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The Nx Plugin for Jest contains executors and generators allowing your workspace to use the powerful Jest testing capabilities.
@nx/jest is a package that integrates Jest testing framework with Nx, a set of extensible dev tools for monorepos. It allows you to run and manage Jest tests efficiently within an Nx workspace.
Running Jest Tests
This configuration allows you to run Jest tests for multiple projects within an Nx workspace. The 'projects' array specifies the paths to the projects you want to include.
module.exports = {
projects: ['<rootDir>/apps/my-app', '<rootDir>/libs/my-lib'],
};
Custom Jest Configuration
This sample shows how to create a custom Jest configuration for a specific project within an Nx workspace. It includes settings for transforming files, module file extensions, and coverage directory.
module.exports = {
displayName: 'my-app',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/my-app',
};
Running Tests with Nx CLI
You can run tests for a specific project using the Nx CLI. This command runs the tests for the 'my-app' project.
nx test my-app
Jest is a delightful JavaScript testing framework with a focus on simplicity. It works out of the box for most JavaScript projects. While @nx/jest integrates Jest with Nx, Jest itself is a standalone testing framework.
Karma is a test runner developed by the AngularJS team. It allows you to run tests in multiple real browsers. Unlike @nx/jest, which is focused on Jest integration, Karma is more about running tests in different environments.
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser. It makes asynchronous testing simple. Mocha is more flexible and less opinionated compared to Jest, which is more integrated and comes with more built-in features.
Nx is a next generation build system with first class monorepo support and powerful integrations.
This package is a Jest plugin for Nx.
Using npx
npx create-nx-workspace
Using npm init
npm init nx-workspace
Using yarn create
yarn create nx-workspace
Run:
npx nx@latest init
FAQs
The Nx Plugin for Jest contains executors and generators allowing your workspace to use the powerful Jest testing capabilities.
We found that @nx/jest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.