Skip to content

Commit dfa75b5

Browse files
authored
Tooling and housekeeping (#70)
* Adds tests for making sure package is sane * bumps codecov * bumps babel deps * Use nyc, instead of istanbul (#71)
1 parent a74644c commit dfa75b5

File tree

11 files changed

+38
-24
lines changed

11 files changed

+38
-24
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ lib-cov
1515
coverage
1616
lib
1717

18+
.nyc_output
19+
1820
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
1921
.grunt
2022

.istanbul.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.nvmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
4.6
2+

.nycrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"reporter": [
3+
"lcov",
4+
"text-summary"
5+
],
6+
"exclude": [
7+
"**/spec/**",
8+
"lib/"
9+
]
10+
}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"scripts": {
1010
"build": "./node_modules/.bin/babel src/ -d lib/",
11-
"test": "TESTING=1 ./node_modules/.bin/istanbul cover ./node_modules/.bin/jasmine",
11+
"test": "TESTING=1 nyc ./node_modules/.bin/jasmine",
1212
"prepublish": "npm run build"
1313
},
1414
"keywords": [
@@ -23,14 +23,14 @@
2323
"author": "Parse",
2424
"license": "MIT",
2525
"devDependencies": {
26-
"babel-cli": "^6.23.0",
27-
"babel-core": "^6.22.0",
28-
"babel-preset-es2015": "^6.6.0",
26+
"babel-cli": "^6.24.0",
27+
"babel-core": "^6.24.0",
28+
"babel-preset-es2015": "^6.24.0",
2929
"babel-preset-stage-0": "^6.22.0",
30-
"codecov": "^1.0.1",
31-
"istanbul": "1.1.0-alpha.1",
30+
"codecov": "2.1.0",
3231
"jasmine": "2.5.3",
33-
"jasmine-spec-reporter": "^3.2.0"
32+
"jasmine-spec-reporter": "^3.2.0",
33+
"nyc": "^10.1.2"
3434
},
3535
"dependencies": {
3636
"apn": "^1.7.8",

spec/APNS.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var APNS = require('../src/APNS');
1+
var APNS = require('../src/APNS').default;
22
var Parse = require('parse/node');
33

44
describe('APNS', () => {

spec/GCM.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var GCM = require('../src/GCM');
1+
var GCM = require('../src/GCM').default;
22

33
function mockSender(gcm) {
44
return spyOn(gcm.sender, 'send').and.callFake(function(message, options, timeout, cb) {

spec/ParsePushAdapter.spec.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
var ParsePushAdapter = require('../src/index').ParsePushAdapter;
1+
var ParsePushAdapterPackage = require('../src/index');
2+
var ParsePushAdapter = ParsePushAdapterPackage.ParsePushAdapter;
23
var randomString = require('../src/PushAdapterUtils').randomString;
3-
var APNS = require('../src/APNS');
4-
var GCM = require('../src/GCM');
4+
var APNS = require('../src/APNS').default;
5+
var GCM = require('../src/GCM').default;
56
var MockAPNConnection = require('./MockAPNConnection');
67

78
describe('ParsePushAdapter', () => {
@@ -14,6 +15,14 @@ describe('ParsePushAdapter', () => {
1415
jasmine.restoreLibrary('apn', 'Connection');
1516
});
1617

18+
it('properly export the module', () => {
19+
expect(typeof ParsePushAdapterPackage.default).toBe('function');
20+
expect(typeof ParsePushAdapterPackage.ParsePushAdapter).toBe('function');
21+
expect(typeof ParsePushAdapterPackage.APNS).toBe('function');
22+
expect(typeof ParsePushAdapterPackage.GCM).toBe('function');
23+
expect(typeof ParsePushAdapterPackage.utils).toBe('object');
24+
});
25+
1726
it('can be initialized', (done) => {
1827
// Make mock config
1928
var pushConfig = {

src/APNS.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const LOG_PREFIX = 'parse-server-push-adapter APNS';
1919
* @param {String} args.bundleId The bundleId for cert
2020
* @param {Boolean} args.production Specifies which environment to connect to: Production (if true) or Sandbox
2121
*/
22-
function APNS(args) {
22+
export default function APNS(args) {
2323
// typePushConfig can be an array.
2424
let apnsArgsList = [];
2525
if (Array.isArray(args)) {
@@ -260,5 +260,3 @@ if (process.env.TESTING) {
260260
APNS.chooseConns = chooseConns;
261261
APNS.handleTransmissionError = handleTransmissionError;
262262
}
263-
module.exports = APNS;
264-
export default APNS;

src/GCM.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const LOG_PREFIX = 'parse-server-push-adapter GCM';
99
const GCMTimeToLiveMax = 4 * 7 * 24 * 60 * 60; // GCM allows a max of 4 weeks
1010
const GCMRegistrationTokensMax = 1000;
1111

12-
function GCM(args) {
12+
export default function GCM(args) {
1313
if (typeof args !== 'object' || !args.apiKey) {
1414
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
1515
'GCM Configuration is invalid');
@@ -172,6 +172,3 @@ GCM.generateGCMPayload = generateGCMPayload;
172172
if (process.env.TESTING) {
173173
GCM.sliceDevices = sliceDevices;
174174
}
175-
176-
module.exports = GCM;
177-
export default GCM;

src/ParsePushAdapter.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { classifyInstallations } from './PushAdapterUtils';
77

88
const LOG_PREFIX = 'parse-server-push-adapter';
99

10-
export class ParsePushAdapter {
10+
export default class ParsePushAdapter {
1111

1212
supportsPushTracking = true;
1313

@@ -76,5 +76,3 @@ export class ParsePushAdapter {
7676
})
7777
}
7878
}
79-
export default ParsePushAdapter;
80-
module.exports = ParsePushAdapter;

0 commit comments

Comments
 (0)