
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
yeoman-test
Advanced tools
Test utilities for Yeoman generators
$ npm install --save-dev yeoman-test
Install target environment and generator:
$ npm install --save-dev yeoman-generator@xxx yeoman-environment@xxx
Usage using the convenience last RunResult instance:
import helpers, { result } from 'yeoman-test';
describe('generator test', () => {
describe('test', () => {
beforeEach(async () => {
await helpers
.run( // instantiates RunContext
'namespace', // namespace or generator
{}, // test options
{} // environment options
)
[.cd(dir)] // runs the test inside a non temporary dir
[.onTargetDirectory(dir => {}) // prepares the test dir
[.withGenerators([])] // registers additional generators
[.withLookups({})] // runs Environment lookups
[.withOptions({})] // passes options to the generator
[.withLocalConfig({})] // sets the generator config as soon as it is instantiated
[.withAnswers()] // simulates the prompt answers
[.withMockedGenerators(['namespace', ...])] // adds a mocked generator to the namespaces
[.withFiles({
'foo.txt': 'bar',
'test.json', { content: true },
})] // add files to mem-fs
[.withYoRc({ 'generator-foo': { bar: {} } })] // add config to .yo-rc.json
[.withYoRcConfig('generator-foo.bar', { : {} })] // same as above
[.commitFiles()] // commit mem-fs files to disk
[.onGenerator(gen => {})] // do something with the generator
[.onEnvironment(env => {})]; // do something with the environment
[await result.create('another-generator').run();] // instantiates a new RunContext at the same directory
);
it('runs correctly', () => {
// runs assertions using mem-fs.
[result.assertFile('file.txt');]
[result.assertNoFile('file.txt');]
[result.assertFileContent('file.txt', 'content');]
[result.assertEqualsFileContent('file.txt', 'content');]
[result.assertNoFileContent('file.txt', 'content');]
[result.assertJsonFileContent('file.txt', {});]
[result.assertNoJsonFileContent('file.txt', {});]
});
});
});
Generator compose:
import assert from 'assert';
import helpers, { result } from 'yeoman-test';
describe('my-gen', () => {
before(() => helpers.run('my-gen').withMockedGenerator(['composed-gen']));
it('should compose with composed-gen', () => {
assert(result.mockedGenerators['composed-gen'].calledOnce);
});
});
Generic test folder:
import helpers, { result } from 'yeoman-test';
describe('generic test', () => {
before(() => helpers.prepareTemporaryDir());
it('test', () => {
result.assert...;
});
});
See our api documentation for latest yeoman-test release.
See our api documentation for yeoman-test 5.0.1. Use 5.x for yeoman-environment 2.x support.
See our api documentation for yeoman-test 2.x.
See our documentation for yeoman-test 2.x.
MIT © The Yeoman Team
FAQs
Test utilities for Yeoman generators
The npm package yeoman-test receives a total of 24,539 weekly downloads. As such, yeoman-test popularity was classified as popular.
We found that yeoman-test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.