From ded6598041852e44d3c5c37015915e7d210f6bf3 Mon Sep 17 00:00:00 2001 From: Gaurav Lahoti Date: Tue, 24 Apr 2018 20:17:21 +0530 Subject: [PATCH] added coverage support --- .gitignore | 3 ++- .travis.yml | 5 ++++- README.md | 3 +++ package.json | 3 +++ test/test.js | 5 ++--- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8bcf3cd..eb0b6fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules dist/ .DS_Store -*.log \ No newline at end of file +*.log +coverage \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index a44b898..6f19357 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,7 @@ node_js : install: - npm install script: - - npm test \ No newline at end of file + - npm test + +# Send coverage data to Coveralls +after_script: "cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js" \ No newline at end of file diff --git a/README.md b/README.md index cb41922..c470341 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # redux-persist-transform-compress-encrypt + +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebook/react/blob/master/LICENSE) [![Build Status](https://travis-ci.org/Dante-101/redux-persist-transform-compress-encrypt.svg?branch=master)](https://travis-ci.org/Dante-101/redux-persist-transform-compress-encrypt) + To persist a compressed and encrypted Redux store The package creates a transformer for redux-persist. The transformer stringifies the inbound state, compresses it using [`lz-string`](https://github.com/pieroxy/lz-string) and encrypts the compressed string with AES. diff --git a/package.json b/package.json index 233fc91..b6225c0 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "types": "dist/index.d.ts", "scripts": { "test": "mocha ./test/test.js", + "cover": "istanbul cover node_modules/mocha/bin/_mocha test/*.js -- -R spec", "clean": "rimraf dist", "prebuild": "npm run clean", "build": "tsc", @@ -32,6 +33,8 @@ "@types/mocha": "^5.2.0", "@types/react": "^16.3.12", "chai": "^4.1.2", + "coveralls": "^3.0.0", + "istanbul": "^0.4.5", "mocha": "^5.1.1", "react": "^16.3.2", "redux": "^4.0.0", diff --git a/test/test.js b/test/test.js index 2288023..73eb543 100644 --- a/test/test.js +++ b/test/test.js @@ -3,8 +3,8 @@ const createCompressEncryptTransform = require('../dist/index.js').default describe('redux persist transform ', () => { const secretKey = 'sample test key 1' - const onError = () => { - expect.fail("there should not be any error") + const onError = (e) => { + expect.fail(e, undefined, "unexpected error: " + e.message) } const transform = createCompressEncryptTransform({ secretKey: secretKey, onError }) @@ -78,5 +78,4 @@ describe('redux persist transform ', () => { const reconstructedState = newTransform.out(persistString) expect(reconstructedState).to.not.exist }) - }) \ No newline at end of file