jasmine-auto-spies
Advanced tools
Comparing version 5.4.0 to 6.0.0
module.exports = { | ||
extends: ['@commitlint/config-conventional'] | ||
extends: ['@commitlint/config-conventional'], | ||
ignores: [(message) => message.includes('WIP')], | ||
}; |
{ | ||
"name": "jasmine-auto-spies", | ||
"version": "5.4.0", | ||
"version": "6.0.0", | ||
"repository": { | ||
@@ -9,16 +9,17 @@ "type": "git", | ||
"description": "Create automatic spies from classes in jasmine tests, also for promises and observables", | ||
"main": "src/index.js", | ||
"types": "src/index.d.ts", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"clean": "rimraf src/**/*.js* src/**/*.d.ts *.d.ts", | ||
"clean": "rimraf dist", | ||
"commit": "git-cz", | ||
"build": "tsc", | ||
"compile": "tsc -p tsconfig.build.json", | ||
"build": "run-s clean compile", | ||
"test": "karma start", | ||
"test:watch": "karma start --auto-watch --no-single-run", | ||
"test:full": "yarn run lint&& yarn run test", | ||
"test:full": "run-s lint test", | ||
"format:fix": "pretty-quick --staged", | ||
"lint": "tslint -p .", | ||
"lint": "eslint . --ext .js,.ts", | ||
"lint:fix": "eslint . --ext .js,.ts --fix", | ||
"lint:commitmsg": "commitlint -E HUSKY_GIT_PARAMS", | ||
"prepublishOnly": "yarn run build", | ||
"postpublish": "yarn run clean", | ||
"travis-deploy-once": "travis-deploy-once", | ||
@@ -52,42 +53,44 @@ "semantic-release": "semantic-release" | ||
"devDependencies": { | ||
"@commitlint/cli": "7.0.0", | ||
"@commitlint/config-conventional": "7.0.1", | ||
"@commitlint/cli": "9.1.2", | ||
"@commitlint/config-conventional": "9.1.2", | ||
"@hirez_io/jasmine-given": "1.0.4", | ||
"@types/deep-equal": "1.0.1", | ||
"@types/jasmine": "^2.5.53", | ||
"@types/jasmine-given": "^2.6.0", | ||
"@types/tapable": "0.2.5", | ||
"@types/webpack": "4.4.11", | ||
"awesome-typescript-loader": "^3.1.3", | ||
"commitizen": "3.1.2", | ||
"cz-conventional-changelog": "2.1.0", | ||
"husky": "2.0.0", | ||
"@types/jasmine": "^3.5.14", | ||
"@types/tapable": "1.0.6", | ||
"@types/webpack": "4.41.21", | ||
"@typescript-eslint/eslint-plugin": "^3.10.1", | ||
"@typescript-eslint/parser": "^3.10.1", | ||
"awesome-typescript-loader": "^5.2.1", | ||
"commitizen": "4.2.0", | ||
"cz-conventional-changelog": "3.2.1", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"husky": "4.2.5", | ||
"istanbul-instrumenter-loader": "3.0.1", | ||
"jasmine": "3.5.0", | ||
"jasmine-given": "^2.6.4", | ||
"karma": "^1.7.0", | ||
"karma-chrome-launcher": "2.2.0", | ||
"karma-coverage-istanbul-reporter": "2.0.1", | ||
"karma-jasmine": "1.1.0", | ||
"karma-jasmine-diff-reporter": "1.2.0", | ||
"karma-jasmine-given": "0.1.1", | ||
"jasmine-core": "3.6.0", | ||
"karma": "^5.1.1", | ||
"karma-chrome-launcher": "3.1.0", | ||
"karma-coverage-istanbul-reporter": "3.0.3", | ||
"karma-jasmine": "4.0.1", | ||
"karma-jasmine-diff-reporter": "2.0.0", | ||
"karma-mocha-reporter": "2.2.5", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-typescript": "^3.0.4", | ||
"karma-webpack": "^2.0.3", | ||
"prettier": "1.14.2", | ||
"pretty-quick": "1.6.0", | ||
"rimraf": "2.6.1", | ||
"karma-sourcemap-loader": "^0.3.8", | ||
"karma-typescript": "^5.1.0", | ||
"karma-webpack": "^4.0.2", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.1.0", | ||
"pretty-quick": "3.0.0", | ||
"rimraf": "3.0.2", | ||
"rxjs": "^6.0.0", | ||
"semantic-release": "^15.6.0", | ||
"semantic-release": "^17.1.1", | ||
"travis-deploy-once": "^5.0.0", | ||
"ts-node": "^3.0.6", | ||
"tslint": "5.18.0", | ||
"typescript": "^3.5.3", | ||
"webpack": "2.7.0" | ||
"webpack": "4.44.1" | ||
}, | ||
"dependencies": { | ||
"deep-equal": "1.0.1" | ||
"deep-equal": "2.0.3" | ||
}, | ||
"peerDependencies": { | ||
"jasmine": ">=2.6.0 <=3.5.0", | ||
"jasmine-core": ">=2.6.0 <=3.6.0", | ||
"rxjs": "^6.0.0", | ||
@@ -94,0 +97,0 @@ "typescript": ">=2.8.1" |
@@ -47,3 +47,3 @@ # jasmine-auto-spies | ||
✅ **Keep you tests DRY** - no more repeated spy setup code, no need for separate spy files | ||
✅ **Keep your tests DRY** - no more repeated spy setup code, no need for separate spy files | ||
@@ -254,55 +254,1 @@ ✅ **Type completion** for both the original Class and the spy methods | ||
``` | ||
--- | ||
## ObserverSpy 👀💪 | ||
#### `new ObserverSpy()` | ||
In order to test more complicated observables, | ||
you can use an `ObserverSpy` instance to "record" all the messages a source observable emits and get them as an array. | ||
You can also spy on the `error` or `complete` states of the observer. | ||
**Usage:** | ||
```js | ||
it('should spy on Observable values', () => { | ||
const observerSpy = new ObserverSpy(); | ||
const fakeValues = ['first', 'second', 'third']; | ||
const fakeObservable = of(...fakeValues); | ||
const subscription = fakeObservable.subscribe(observerSpy); | ||
// DO SOME LOGIC HERE | ||
// unsubscribing is optional, it's good for stopping intervals etc | ||
subscription.unsubscribe(); | ||
expect(observerSpy.receivedNext()).toBe(true); | ||
expect(observerSpy.getValues()).toEqual(fakeValues); | ||
expect(observerSpy.getValuesLength()).toEqual(3); | ||
expect(observerSpy.getFirstValue()).toEqual('first'); | ||
expect(observerSpy.getValueAt(1)).toEqual('second'); | ||
expect(observerSpy.getLastValue()).toEqual('third'); | ||
expect(observerSpy.receivedComplete()).toBe(true); | ||
}); | ||
it('should spy on Observable errors', () => { | ||
const observerSpy = new ObserverSpy(); | ||
const fakeObservable = throwError('FAKE ERROR'); | ||
fakeObservable.subscribe(observerSpy); | ||
expect(observerSpy.receivedError()).toBe(true); | ||
expect(observerSpy.getError()).toEqual('FAKE ERROR'); | ||
}); | ||
``` |
@@ -12,7 +12,9 @@ { | ||
"downlevelIteration": true, | ||
"lib": ["es2015", "es2016"], | ||
"lib": ["es2015", "es2016", "DOM"], | ||
"pretty": true, | ||
"strict": true | ||
"strict": true, | ||
"typeRoots": ["node_modules/types", "node_modules"], | ||
"types": ["@hirez_io/jasmine-given"] | ||
}, | ||
"include": ["src"] | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
300482
60
1697
36
253
1
+ Addedarray-buffer-byte-length@1.0.2(transitive)
+ Addedarraybuffer.prototype.slice@1.0.4(transitive)
+ Addedasync-function@1.0.0(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddata-view-buffer@1.0.2(transitive)
+ Addeddata-view-byte-length@1.0.2(transitive)
+ Addeddata-view-byte-offset@1.0.1(transitive)
+ Addeddeep-equal@2.0.3(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-abstract@1.23.9(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-get-iterator@1.1.3(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedfor-each@0.3.4(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.8(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedget-symbol-description@1.1.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.1.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-arguments@1.2.0(transitive)
+ Addedis-array-buffer@3.0.5(transitive)
+ Addedis-async-function@2.1.1(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-finalizationregistry@1.1.1(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.1.1(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.4(transitive)
+ Addedis-string@1.1.1(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedjasmine-core@3.6.0(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-is@1.1.6(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedown-keys@1.0.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedreflect.getprototypeof@1.0.10(transitive)
+ Addedregexp.prototype.flags@1.5.4(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-push-apply@1.0.0(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedset-proto@1.0.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstop-iteration-iterator@1.1.0(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtyped-array-buffer@1.0.3(transitive)
+ Addedtyped-array-byte-length@1.0.3(transitive)
+ Addedtyped-array-byte-offset@1.0.4(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedunbox-primitive@1.1.0(transitive)
+ Addedwhich-boxed-primitive@1.1.1(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddeep-equal@1.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjasmine@3.5.0(transitive)
- Removedjasmine-core@3.5.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updateddeep-equal@2.0.3