{"library":"sinon-stub-framework","title":"Sinon Stub Framework (Sinon Re-export)","description":"This package, `sinon-stub-framework`, is a minimalistic wrapper that directly re-exports the entire `sinon` library. Its primary function appears to have been to provide the `sinon` package under an alternative name, possibly for historical or specific project reasons. Currently at version 1.0.4, the package has not seen updates in approximately five years (as of early 2026), suggesting it is effectively abandoned. There is no unique functionality, API, or release cadence separate from `sinon` itself, which is a mature and actively maintained library for test spies, stubs, and mocks. Users are strongly advised to install and use `sinon` directly instead of this wrapper to ensure they receive the latest features, bug fixes, and security updates.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install sinon-stub-framework"],"cli":null},"imports":["import { stub } from 'sinon-stub-framework';","import * as sinon from 'sinon-stub-framework';","import { assert } from 'sinon-stub-framework';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { stub } from 'sinon-stub-framework';\n\nclass MyService {\n  fetchData(id) {\n    return Promise.resolve(`Data for ${id}`);\n  }\n  processData(data) {\n    return data.toUpperCase();\n  }\n}\n\ndescribe('MyService', () => {\n  let myService;\n  let fetchDataStub;\n\n  beforeEach(() => {\n    myService = new MyService();\n    // Stub a method to control its behavior during tests\n    fetchDataStub = stub(myService, 'fetchData');\n  });\n\n  afterEach(() => {\n    // Restore the original method after each test\n    fetchDataStub.restore();\n  });\n\n  it('should return stubbed data', async () => {\n    fetchDataStub.returns(Promise.resolve('Mocked Data'));\n    const result = await myService.fetchData(1);\n    expect(result).toBe('Mocked Data');\n    expect(fetchDataStub.calledOnceWith(1)).toBe(true);\n  });\n\n  it('should throw an error when stubbed', async () => {\n    const errorMessage = 'Network Error!';\n    fetchDataStub.throws(new Error(errorMessage));\n    await expect(myService.fetchData(2)).rejects.toThrow(errorMessage);\n    expect(fetchDataStub.calledOnceWith(2)).toBe(true);\n  });\n\n  it('should process data correctly even with stubbed dependency', () => {\n    fetchDataStub.returns(Promise.resolve('raw data'));\n    // Test another method that might rely on fetchData but we control its output\n    const processed = myService.processData('another data'); // Assuming processData doesn't call fetchData here for simplicity\n    expect(processed).toBe('ANOTHER DATA');\n  });\n});","lang":"javascript","description":"Demonstrates basic usage of Sinon stubs, showing how to replace a method's implementation, control its return values, and restore the original function after tests. This code is functionally identical to using `sinon` directly.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}