diff --git a/package.json b/package.json index cbe5bf0..20377a7 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "typings": "./index.d.ts", "scripts": { "umd-build": "rollup -c", - "build": "./node_modules/.bin/babel src --out-dir lib && npm run umd-build", - "lint-src": "./node_modules/.bin/eslint src/**/*.js", - "lint-test": "./node_modules/.bin/eslint test/**/*.js", + "build": "babel src --out-dir lib && npm run umd-build", + "lint-src": "eslint src/{**/,}*.js", + "lint-test": "eslint test/{**/,}*.js", "lint": "npm run lint-src && npm run lint-test", "prepublishOnly": "npm run build", - "pretest": "./node_modules/.bin/babel src --out-dir lib", - "test-run": "./node_modules/.bin/mocha --require @babel/register --recursive", + "pretest": "babel src --out-dir lib", + "test-run": "mocha --require @babel/register --recursive", "test": "npm run lint && npm run test-run" }, "repository": { diff --git a/test/wrapStore.test.js b/test/wrapStore.test.js index 5eb97db..31be69f 100644 --- a/test/wrapStore.test.js +++ b/test/wrapStore.test.js @@ -7,10 +7,10 @@ import { createWrapStore } from '../src'; import shallowDiff from '../src/strategies/shallowDiff/diff'; import { DISPATCH_TYPE, STATE_TYPE, PATCH_STATE_TYPE } from '../src/constants'; -describe('wrapStore', function() { +describe('wrapStore', function () { const channelName = 'test'; - beforeEach(function() { + beforeEach(function () { global.self = {}; const tabs = [1]; @@ -62,10 +62,10 @@ describe('wrapStore', function() { return listeners; } - describe("on receiving messages", function() { + describe("on receiving messages", function () { let listeners, store, payload, message, sender, callback; - beforeEach(function() { + beforeEach(function () { listeners = setupListeners(); store = { dispatch: sinon.spy(), @@ -87,7 +87,7 @@ describe('wrapStore', function() { callback = () => { }; // noop. Maybe should validate it is invoked? }); - it('should dispatch actions received on onMessage to store', async function() { + it('should dispatch actions received on onMessage to store', async function () { const wrapStore = createWrapStore(); wrapStore(store, { channelName }); @@ -105,7 +105,7 @@ describe('wrapStore', function() { .should.eql(true); }); - it('should not dispatch actions received on onMessage for other ports', function() { + it('should not dispatch actions received on onMessage for other ports', function () { const wrapStore = createWrapStore(); wrapStore(store, { channelName }); @@ -115,7 +115,7 @@ describe('wrapStore', function() { store.dispatch.notCalled.should.eql(true); }); - it('should deserialize incoming messages correctly', async function() { + it('should deserialize incoming messages correctly', async function () { const deserializer = sinon.spy(JSON.parse); const wrapStore = createWrapStore(); @@ -135,7 +135,7 @@ describe('wrapStore', function() { .should.eql(true); }); - it('should not deserialize incoming messages for other ports', function() { + it('should not deserialize incoming messages for other ports', function () { const deserializer = sinon.spy(JSON.parse); const wrapStore = createWrapStore(); @@ -148,7 +148,7 @@ describe('wrapStore', function() { }); }); - it('should serialize initial state and subsequent patches correctly', function() { + it('should serialize initial state and subsequent patches correctly', function () { const sendMessage = (self.chrome.tabs.sendMessage = sinon.spy()); // Mock store subscription @@ -195,7 +195,7 @@ describe('wrapStore', function() { sendMessage.secondCall.args[1].should.eql(expectedPatchMessage); }); - it('should use the provided diff strategy', function() { + it('should use the provided diff strategy', function () { const sendMessage = (self.chrome.tabs.sendMessage = sinon.spy()); // Mock store subscription @@ -240,7 +240,7 @@ describe('wrapStore', function() { sendMessage.secondCall.args[1].should.eql(expectedPatchMessage); }); - describe("when validating options", function() { + describe("when validating options", function () { const store = { dispatch: sinon.spy(), subscribe: () => { @@ -249,7 +249,7 @@ describe('wrapStore', function() { getState: () => ({}) }; - it('should use defaults if no options present', function() { + it('should use defaults if no options present', function () { should.doesNotThrow(() => { const wrapStore = createWrapStore(); @@ -257,7 +257,7 @@ describe('wrapStore', function() { }); }); - it('should throw an error if serializer is not a function', function() { + it('should throw an error if serializer is not a function', function () { should.throws(() => { const wrapStore = createWrapStore(); @@ -265,7 +265,7 @@ describe('wrapStore', function() { }, Error); }); - it('should throw an error if deserializer is not a function', function() { + it('should throw an error if deserializer is not a function', function () { should.throws(() => { const wrapStore = createWrapStore(); @@ -273,7 +273,7 @@ describe('wrapStore', function() { }, Error); }); - it('should throw an error if diffStrategy is not a function', function() { + it('should throw an error if diffStrategy is not a function', function () { should.throws(() => { const wrapStore = createWrapStore(); @@ -284,7 +284,7 @@ describe('wrapStore', function() { it( 'should send a safety message to all tabs once initialized', - function() { + function () { const tabs = [123, 456, 789, 1011, 1213]; const tabResponders = []; const store = {