Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ lib-cov
coverage
lib

.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

Expand Down
2 changes: 0 additions & 2 deletions .istanbul.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
4.6

10 changes: 10 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"reporter": [
"lcov",
"text-summary"
],
"exclude": [
"**/spec/**",
"lib/"
]
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"scripts": {
"build": "./node_modules/.bin/babel src/ -d lib/",
"test": "TESTING=1 ./node_modules/.bin/istanbul cover ./node_modules/.bin/jasmine",
"test": "TESTING=1 nyc ./node_modules/.bin/jasmine",
"prepublish": "npm run build"
},
"keywords": [
Expand All @@ -23,14 +23,14 @@
"author": "Parse",
"license": "MIT",
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-core": "^6.22.0",
"babel-preset-es2015": "^6.6.0",
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-stage-0": "^6.22.0",
"codecov": "^1.0.1",
"istanbul": "1.1.0-alpha.1",
"codecov": "2.1.0",
"jasmine": "2.5.3",
"jasmine-spec-reporter": "^3.2.0"
"jasmine-spec-reporter": "^3.2.0",
"nyc": "^10.1.2"
},
"dependencies": {
"apn": "^1.7.8",
Expand Down
2 changes: 1 addition & 1 deletion spec/APNS.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var APNS = require('../src/APNS');
var APNS = require('../src/APNS').default;
var Parse = require('parse/node');

describe('APNS', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/GCM.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var GCM = require('../src/GCM');
var GCM = require('../src/GCM').default;

function mockSender(gcm) {
return spyOn(gcm.sender, 'send').and.callFake(function(message, options, timeout, cb) {
Expand Down
15 changes: 12 additions & 3 deletions spec/ParsePushAdapter.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var ParsePushAdapter = require('../src/index').ParsePushAdapter;
var ParsePushAdapterPackage = require('../src/index');
var ParsePushAdapter = ParsePushAdapterPackage.ParsePushAdapter;
var randomString = require('../src/PushAdapterUtils').randomString;
var APNS = require('../src/APNS');
var GCM = require('../src/GCM');
var APNS = require('../src/APNS').default;
var GCM = require('../src/GCM').default;
var MockAPNConnection = require('./MockAPNConnection');

describe('ParsePushAdapter', () => {
Expand All @@ -14,6 +15,14 @@ describe('ParsePushAdapter', () => {
jasmine.restoreLibrary('apn', 'Connection');
});

it('properly export the module', () => {
expect(typeof ParsePushAdapterPackage.default).toBe('function');
expect(typeof ParsePushAdapterPackage.ParsePushAdapter).toBe('function');
expect(typeof ParsePushAdapterPackage.APNS).toBe('function');
expect(typeof ParsePushAdapterPackage.GCM).toBe('function');
expect(typeof ParsePushAdapterPackage.utils).toBe('object');
});

it('can be initialized', (done) => {
// Make mock config
var pushConfig = {
Expand Down
4 changes: 1 addition & 3 deletions src/APNS.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const LOG_PREFIX = 'parse-server-push-adapter APNS';
* @param {String} args.bundleId The bundleId for cert
* @param {Boolean} args.production Specifies which environment to connect to: Production (if true) or Sandbox
*/
function APNS(args) {
export default function APNS(args) {
// typePushConfig can be an array.
let apnsArgsList = [];
if (Array.isArray(args)) {
Expand Down Expand Up @@ -260,5 +260,3 @@ if (process.env.TESTING) {
APNS.chooseConns = chooseConns;
APNS.handleTransmissionError = handleTransmissionError;
}
module.exports = APNS;
export default APNS;
5 changes: 1 addition & 4 deletions src/GCM.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const LOG_PREFIX = 'parse-server-push-adapter GCM';
const GCMTimeToLiveMax = 4 * 7 * 24 * 60 * 60; // GCM allows a max of 4 weeks
const GCMRegistrationTokensMax = 1000;

function GCM(args) {
export default function GCM(args) {
if (typeof args !== 'object' || !args.apiKey) {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
'GCM Configuration is invalid');
Expand Down Expand Up @@ -172,6 +172,3 @@ GCM.generateGCMPayload = generateGCMPayload;
if (process.env.TESTING) {
GCM.sliceDevices = sliceDevices;
}

module.exports = GCM;
export default GCM;
4 changes: 1 addition & 3 deletions src/ParsePushAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { classifyInstallations } from './PushAdapterUtils';

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

export class ParsePushAdapter {
export default class ParsePushAdapter {

supportsPushTracking = true;

Expand Down Expand Up @@ -76,5 +76,3 @@ export class ParsePushAdapter {
})
}
}
export default ParsePushAdapter;
module.exports = ParsePushAdapter;