Registry / testing / repository-provider-test-support

repository-provider-test-support

JSON →
library5.0.15jsnpmunverified

repository-provider-test-support is a utility package designed to provide test support functionalities for libraries that implement the repository-provider interface. It offers helper functions, such as `generateBranchName`, which assists in creating unique branch names within a test environment, often by incorporating a numeric suffix based on a pattern. The package is currently at version 5.0.15 and appears to have a regular release cadence focused on dependency updates and minor bug fixes, indicating active maintenance. It is specifically tailored for testing purposes, making it distinct from general-purpose utility libraries by focusing on the specific needs of repository-provider implementations, such as mock data generation or environment setup for isolated testing. It requires Node.js version 24.11.1 or higher.

npm install repository-provider-test-support
INSTALL
IMPORT
SIG · REPOSITORY-PROVIDE
R
repository-provider-test-support
testingjavascriptv5.0.15
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

generateBranchName
import { generateBranchName } from 'repository-provider-test-support';
const { generateBranchName } = require('repository-provider-test-support');
This package ships with TypeScript types and targets modern Node.js environments. While CommonJS `require()` might work in some transpiled or older setups, ESM `import` is the idiomatic and recommended way to consume this library, especially given its `node: >=24.11.1` engine requirement.
Repository
import type { Repository } from 'repository-provider-test-support';
import { Repository } from 'repository-provider-test-support';
When using TypeScript, `Repository` is typically imported as a type for declaration purposes. It represents the interface expected by functions like `generateBranchName`.
* as TestSupport
import * as TestSupport from 'repository-provider-test-support';
const TestSupport = require('repository-provider-test-support');
This pattern imports all named exports into a single namespace object, useful for accessing multiple utilities without individual named imports. Ensure your build system supports this for ESM.

Demonstrates how to import and use the `generateBranchName` function to create unique branch names within a test environment, by supplying a mock `Repository` object.

import { generateBranchName } from 'repository-provider-test-support'; // Define a minimal mock Repository interface matching the expected API interface MockRepository { listBranches(): Promise<{ name: string }[]>; } async function demonstrateBranchNameGeneration() { // Create a mock repository instance for testing const mockRepo: MockRepository = { listBranches: async () => [ { name: 'main' }, { name: 'feature/alpha' }, { name: 'feature/beta' }, { name: 'hotfix/1.0.1' }, { name: 'bugfix/1' }, { name: 'bugfix/2' } ], }; // Generate a new branch name for a general feature pattern const newFeatureBranch = await generateBranchName(mockRepo, 'feature/*'); console.log(`Generated feature branch: ${newFeatureBranch}`); // Expected output if feature/alpha, feature/beta exist: 'feature/1' or 'feature/gamma' depending on internal logic. // Based on README: 'feature/*' implies 'feature/1', 'feature/2', etc. // Generate a new branch name for a bugfix, iterating on existing ones const nextBugfixBranch = await generateBranchName(mockRepo, 'bugfix/*'); console.log(`Generated next bugfix branch: ${nextBugfixBranch}`); // Expected output: 'bugfix/3' // Generate a branch name for a specific release iteration const releaseCandidateBranch = await generateBranchName(mockRepo, 'release/v1.1.*'); console.log(`Generated release candidate branch: ${releaseCandidateBranch}`); // Expected output: 'release/v1.1.1' if 'release/v1.1.0' doesn't exist } demonstrateBranchNameGeneration().catch(console.error);
Debug
Known issues
breakingThis package explicitly requires Node.js version 24.11.1 or higher, as stated in its `engines` field. Running it on older Node.js versions will result in errors.
fix
Upgrade your Node.js runtime environment to version 24.11.1 or newer. Tools like `nvm` (Node Version Manager) can help manage multiple Node.js versions.
affects: >=5.0.0
breakingMajor version 5 likely introduces breaking API changes compared to previous major versions, though specific details are not provided in the recent changelog excerpts. It's common for major version bumps to include breaking changes to API signatures or module system compatibility (e.g., favoring ESM).
fix
Refer to the official GitHub repository's release notes or migration guides for specific breaking changes if upgrading from a version older than 5.x.x.
affects: >=5.0.0
gotchaThe `generateBranchName` function requires a `Repository` object that implements a `listBranches()` method. Ensure your mock or actual `Repository` object conforms to this interface to avoid runtime TypeErrors.
fix
Provide an object with a `listBranches(): Promise<{ name: string }[]>;` method as the first argument to `generateBranchName`.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: (0 , repository_provider_test_support__WEBPACK_IMPORTED_MODULE_0__.generateBranchName) is not a function
This error typically indicates an incorrect import statement when using ESM, or attempting to use CommonJS `require()` in an ESM-only context.
fix
Ensure you are using `import { generateBranchName } from 'repository-provider-test-support';` and that your project's `package.json` specifies `"type": "module"` or your build configuration is set up for ESM.
Error: This package requires Node.js version >=24.11.1. You are running vX.Y.Z.
The installed Node.js version does not meet the minimum requirement specified by the package.
fix
Update your Node.js environment to version 24.11.1 or newer. Use `nvm install 24` and `nvm use 24` (or similar for other Node.js version managers).
Upgrade
Version history
5.0.15latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
repository-provider-test-support — npm install repository-provider-test-support · libregistry