diff --git a/README.md b/README.md index 32f44ca..28e3934 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -ts-stubber / [Exports](modules.md) - # ts-stubber ![ts-stubber](https://github.com/ShellyDCMS/ts-stubber/actions/workflows/npm-publish.yml/badge.svg) @@ -39,13 +37,14 @@ class MyClass { throw new Error("Should not be called"); } } - +// creating a stubbed instance using sinon const sinonStubbedInstanceCreator = StubbedInstanceCreator( () => sinon.stub() ); const sinonMockMyClass = sinonStubbedInstanceCreator.createStubbedInstance(); +// creating a stubbed instance using jest const jestStubbedInstanceCreator = StubbedInstanceCreator( () => jest.fn() ); diff --git a/package.json b/package.json index d0c25f8..ff117a4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ts-stubber", "description": "Lazy Stubbing a TypeScript Class or Interface with any Mocking Framework for testing in Isolation", - "version": "1.0.4", + "version": "1.0.5", "author": "Shelly Goldblit", "private": false, "license": "MIT", diff --git a/src/stub-builder.ts b/src/stub-builder.ts index e6e2794..35a86d0 100644 --- a/src/stub-builder.ts +++ b/src/stub-builder.ts @@ -86,31 +86,3 @@ export const StubbedInstanceCreator = ( }; return { createStubbedInstance }; }; - -const defaultExcludedMethods: (string | RegExp)[] = [ - "__defineGetter__", - "__defineSetter__", - "hasOwnProperty", - "__lookupGetter__", - "__lookupSetter__", - "propertyIsEnumerable", - "toString", - "valueOf", - "__proto__", - "toLocaleString", - "isPrototypeOf", - "then", - /^_\$lit\S+\$$/ -]; - -const shouldExcludeFunction = ( - prop: string, - excludedMethods: (string | RegExp)[] -) => { - const matches = excludedMethods.filter((excludedMethod: string | RegExp) => - typeof excludedMethod === "string" - ? excludedMethod === prop - : excludedMethod.test(prop) - ); - return matches.length; -};