
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
tdd-buffet
Advanced tools
All you can eat TDD tools and libraries
npm install tdd-buffet
This package exposes a wrapper over Jest that provides the same building blocks for writing tests (describe
and it
) and also provides the same CLI.
Ideally you should have many of these since they're fast to run. They execute in a jsdom environment so you can test both your Node libraries and your React components. Since they're fast, you should use them to check your code's correctness and achieve satisfactory coverage.
import { describe, it } from 'tdd-buffet/suite/node';
import { expect } from 'tdd-buffet/suite/chai';
describe('Node suite', () => {
it('should run a test', () => {
expect(1).to.equal(1);
});
});
These tests will spin up Puppeteer in headless mode and pass the page
instance in the test callback. The browser and page will be set up once per test suite and persisted between individual tests.
These tests are slower than Node tests. Therefore, you should not rely on them to exhaustively check the correctness of your code. You can start with them to have some basic coverage, but try to make your down to smaller, faster, more focused tests.
import { describe, it } from 'tdd-buffet/suite/gui';
describe('Gui suite', () => {
it('should run a test', async (page) => {
await page.goto('http://github.com');
});
});
You can choose between jest's builtin assertions or chai's assertions.
import { describe, it } from 'tdd-buffet/suite/node';
import { expect as chaiExpect } from 'tdd-buffet/expect/chai';
import { expect as jestExpect } from 'tdd-buffet/expect/jest';
describe('Expect', () => {
describe('chai', () => {
it('should compare things', () => {
chaiExpect(1).to.equal(1);
chaiExpect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
});
});
describe('jest', () => {
it('should compare things', () => {
jestExpect(1).toEqual(1);
jestExpect({ foo: 'bar' }).toEqual({ foo: 'bar' });
});
});
});
npx tdd-buffet test
This will run all the tests matched by the default Jest config. You can pass your own config through the --config
option. The command accepts all Jest arguments:
npx tdd-buffet test --runInBand tests/my-test.spec.tsx
You can pass the --coverage
option to generate coverage with the options specified in the Jest config.
You can control how coverage is collected (output folder, thresholds etc.) through Jest's coverage options.
FAQs
All you can eat TDD tools and libraries
We found that tdd-buffet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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 uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.