Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@labdigital/commercetools-mock
Advanced tools
[](https://www.npmjs.com/package/@labdigital/commercetools-mock) [![codecov](https://codecov.io/gh/labd/commercetools-node-mock/branch/main/graph/badge.svg?token=muKkNunJ95)](https://c
This library mocks the Commercetools rest API to ease testing of your typescript codebases interacting with the commercetools api. It uses the same proven approach as our testing module in the commercetools Python SDK.
Since version 2 of this library it is based on msw instead
of nock. It is now therefore als recommended to manage the msw server yourself
and use the registerHandlers
method to register the handlers on this server.
This allows you to use the same server for mocking other API's as well.
yarn add --dev @labdigital/commercetools-mock
This codebase is also available as a docker image where it provides a runnable http server exposing the mocked endpoints. See https://hub.docker.com/r/labdigital/commercetools-mock-server
import { CommercetoolsMock, getBaseResourceProperties } from '@labdigital/commercetools-mock'
import { setupServer } from 'msw/node'
const ctMock = new CommercetoolsMock({
apiHost: 'https://localhost',
authHost: 'https://localhost',
enableAuthentication: false,
validateCredentials: false,
defaultProjectKey: 'my-project',
silent: true,
})
describe('A module', () => {
const mswServer = setupServer()
beforeAll(() => {
mswServer.listen({ onUnhandledRequest: "error" })
})
beforeEach(() => {
ctMock.registerHandlers(mswServer)
ctMock.project().add('type', {
...getBaseResourceProperties()
key: 'my-customt-type',
fieldDefinitions: [],
})
})
afterAll(() => {
mswServer.close()
})
afterEach(() => {
server.clearHandlers()
ctMock.clear()
})
test('my function', async () => {
ctMock.project().add('customer', customerFixture)
const res = await myFunction()
expect(res).toEqual(true)
})
})
This codebases use @changesets for release and version management
pnpm changeset
Implement the following:
FAQs
[](https://www.npmjs.com/package/@labdigital/commercetools-mock) [![codecov](https://codecov.io/gh/labd/commercetools-node-mock/branch/main/graph/badge.svg?token=muKkNunJ95)](https://c
We found that @labdigital/commercetools-mock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.