diff --git a/.travis.yml b/.travis.yml index 5833152..0c4ac60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,18 @@ --- language: node_js -node_js: - - "5.11" sudo: false +node_js: +- '0.12' +- '1' +- '2' +- '3' +- '4' +- '5' +- '6' +- '7' + cache: directories: - node_modules diff --git a/CHANGELOG.md b/CHANGELOG.md index bb9338e..4607f3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ ## Changelog ### 2.4.1 (Next) - +* [#139](https://github.com/alexa-js/alexa-app/pull/139): Changed arrow functions to normal functions (see https://mochajs.org/#arrow-functions for more info) - [@tejashah88](https://github.com/tejashah88). +* [#139](https://github.com/alexa-js/alexa-app/pull/139): Added more node versions to run mocha tests on Travis-CI - [@tejashah88](https://github.com/tejashah88). * [#125](https://github.com/alexa-js/alexa-app/pull/125): Force new when instantiating alexa.app - [@OpenDog](https://github.com/OpenDog). * [#119](https://github.com/alexa-js/alexa-app/pull/119): Moved to the [alexa-js organization](https://github.com/alexa-js) - [@dblock](https://github.com/dblock). * [#118](https://github.com/matt-kruse/alexa-app/pull/118), [#117](https://github.com/matt-kruse/alexa-app/issues/117): Prevent updating session attributes directly - [@ajcrites](https://github.com/ajcrites). diff --git a/package.json b/package.json index a496a79..c0a1ba5 100644 --- a/package.json +++ b/package.json @@ -31,20 +31,21 @@ "numbered": "^1.0.0" }, "devDependencies": { + "body-parser": "^1.15.2", "chai": "^3.4.1", "chai-as-promised": "^5.3.0", - "sinon": "^1.17.7", - "sinon-chai": "^2.8.0", - "express": "^4.14.0", - "supertest": "^2.0.1", - "supertest-as-promised": "^4.0.2", + "chai-string": "^1.3.0", "coveralls": "^2.11.9", + "danger": "0.6.10", + "ejs": "^2.5.5", "eslint": "^2.9.0", + "esprima": "^3.1.3", + "express": "^4.14.0", "istanbul": "^0.4.3", "mocha": "^2.3.4", - "danger": "0.6.10", - "body-parser": "^1.15.2", - "ejs": "^2.5.5", - "chai-string": "^1.3.0" + "sinon": "^1.17.7", + "sinon-chai": "^2.8.0", + "supertest": "^2.0.1", + "supertest-as-promised": "^4.0.2" } } diff --git a/test/test_alexa_app_audioplayer.js b/test/test_alexa_app_audioplayer.js index 4b178da..a00c3ab 100644 --- a/test/test_alexa_app_audioplayer.js +++ b/test/test_alexa_app_audioplayer.js @@ -13,40 +13,40 @@ describe("Alexa", function () { describe("app", function () { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); describe("request", function () { context("without an audioPlayer intent", function () { - context("AudioPlayer.PlaybackFinished", () => { + context("AudioPlayer.PlaybackFinished", function() { var mockRequest; - beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_finished.json"); }) + beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_finished.json"); }) - it("should succeed and return empty object ", () => { + it("should succeed and return empty object ", function() { return testApp.request(mockRequest) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); }); }); - context("AudioPlayer.PlaybackFailed", () => { + context("AudioPlayer.PlaybackFailed", function() { var mockRequest; - beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_failed.json"); }) + beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_failed.json"); }) - it("should succeed and return empty object ", () => { + it("should succeed and return empty object ", function() { return testApp.request(mockRequest) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); }); }); - context("AudioPlayer.PlaybackNearlyFinished", () => { + context("AudioPlayer.PlaybackNearlyFinished", function() { var mockRequest; - beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_nearly_finished.json"); }) + beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_nearly_finished.json"); }) - it("should succeed and return empty object ", () => { + it("should succeed and return empty object ", function() { return testApp.request(mockRequest) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); @@ -54,22 +54,22 @@ describe("Alexa", function () { }); - context("AudioPlayer.PlaybackStarted", () => { + context("AudioPlayer.PlaybackStarted", function() { var mockRequest; - beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_started.json"); }) + beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_started.json"); }) - it("should succeed and return empty object ", () => { + it("should succeed and return empty object ", function() { return testApp.request(mockRequest) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); }); }); - context("AudioPlayer.PlaybackStopped", () => { + context("AudioPlayer.PlaybackStopped", function() { var mockRequest; - beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_stopped.json"); }) + beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_stopped.json"); }) - it("should succeed and return empty object ", () => { + it("should succeed and return empty object ", function() { return testApp.request(mockRequest) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); diff --git a/test/test_alexa_app_cards.js b/test/test_alexa_app_cards.js index d8d472f..a535245 100644 --- a/test/test_alexa_app_cards.js +++ b/test/test_alexa_app_cards.js @@ -12,7 +12,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); diff --git a/test/test_alexa_app_initialization.js b/test/test_alexa_app_initialization.js index 33c2399..9e9558e 100644 --- a/test/test_alexa_app_initialization.js +++ b/test/test_alexa_app_initialization.js @@ -13,7 +13,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); diff --git a/test/test_alexa_app_intent.js b/test/test_alexa_app_intent.js index 63d0731..2e289fb 100644 --- a/test/test_alexa_app_intent.js +++ b/test/test_alexa_app_intent.js @@ -12,7 +12,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); @@ -22,7 +22,7 @@ describe("Alexa", function() { context("with schema", function() { var schema = { schema: "yes" }; - beforeEach(() => { + beforeEach(function() { testApp.intent("airportInfoIntent", schema, func); }); @@ -40,7 +40,7 @@ describe("Alexa", function() { }); context("without schema", function() { - beforeEach(() => { + beforeEach(function() { testApp.intent("airportInfoIntent", func); }); diff --git a/test/test_alexa_app_intent_request.js b/test/test_alexa_app_intent_request.js index a179a22..8fc1c19 100644 --- a/test/test_alexa_app_intent_request.js +++ b/test/test_alexa_app_intent_request.js @@ -13,7 +13,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); @@ -24,7 +24,7 @@ describe("Alexa", function() { describe("defaults", function() { var subject; - beforeEach(() => { + beforeEach(function() { subject = testApp.request(mockRequest); }) @@ -46,7 +46,7 @@ describe("Alexa", function() { context("with no intent handler", function() { var subject; - beforeEach(() => { + beforeEach(function() { subject = testApp.request(mockRequest); }) @@ -67,7 +67,7 @@ describe("Alexa", function() { context("with a matching intent handler", function() { var expectedMessage = "tubular!"; - beforeEach(() => { + beforeEach(function() { var intentHandler = function(req, res) { res.say(expectedMessage); return true; diff --git a/test/test_alexa_app_launch_request.js b/test/test_alexa_app_launch_request.js index 1c76ec2..4c9c6a8 100644 --- a/test/test_alexa_app_launch_request.js +++ b/test/test_alexa_app_launch_request.js @@ -13,7 +13,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); diff --git a/test/test_alexa_app_schema.js b/test/test_alexa_app_schema.js index 066ac89..f15d8e7 100644 --- a/test/test_alexa_app_schema.js +++ b/test/test_alexa_app_schema.js @@ -12,12 +12,12 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); describe("#schema", function() { - beforeEach(() => { + beforeEach(function() { testApp.intent("testIntentTwo", { "slots": { "MyCustomSlotType": "CUSTOMTYPE", diff --git a/test/test_alexa_app_session.js b/test/test_alexa_app_session.js index fb14991..31315a7 100644 --- a/test/test_alexa_app_session.js +++ b/test/test_alexa_app_session.js @@ -11,7 +11,7 @@ describe("Alexa", function() { var Alexa = require("../index"); describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); @@ -21,7 +21,7 @@ describe("Alexa", function() { context("intent handler with shouldEndSession = false", function() { var reqObject; - beforeEach(() => { + beforeEach(function() { var intentHandler = function(req, res) { res.say("message").shouldEndSession(false); res.session("foo", true); @@ -36,7 +36,7 @@ describe("Alexa", function() { }); it("reponds with expected context applicationId", function() { - return testApp.request(mockRequest).then((response) => { + return testApp.request(mockRequest).then(function(response) { expect(reqObject.context).to .have.deep.property( "System.application.applicationId", @@ -299,7 +299,7 @@ describe("Alexa", function() { returnedAttributeValue = req.getSession().get("AttributeWhichDoesNotExist"); }; - return testApp.request(mockRequest).then(() => expect(returnedAttributeValue).to.not.be.undefined); + return testApp.request(mockRequest).then(function() { expect(returnedAttributeValue).to.not.be.undefined; }); }); }); }); @@ -315,7 +315,7 @@ describe("Alexa", function() { returnedAttributeValue = req.getSession().get("AttributeWhichDoesNotExist"); }; - return testApp.request(mockRequest).then(() => expect(returnedAttributeValue).to.be.undefined); + return testApp.request(mockRequest).then(function() { expect(returnedAttributeValue).to.be.undefined; }); }); }); }); diff --git a/test/test_alexa_app_session_ended_request.js b/test/test_alexa_app_session_ended_request.js index 5295c7d..fdf9fba 100644 --- a/test/test_alexa_app_session_ended_request.js +++ b/test/test_alexa_app_session_ended_request.js @@ -12,7 +12,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); diff --git a/test/test_alexa_app_unknown_type_request.js b/test/test_alexa_app_unknown_type_request.js index dfbd1d1..bee3811 100644 --- a/test/test_alexa_app_unknown_type_request.js +++ b/test/test_alexa_app_unknown_type_request.js @@ -12,7 +12,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); diff --git a/test/test_alexa_app_utterances_schema.js b/test/test_alexa_app_utterances_schema.js index 7882f9e..c362a9a 100644 --- a/test/test_alexa_app_utterances_schema.js +++ b/test/test_alexa_app_utterances_schema.js @@ -8,12 +8,12 @@ describe("Alexa", function() { var Alexa = require("../index"); describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); }); describe("#utterances", function() { - beforeEach(() => { + beforeEach(function() { testApp.intent("testIntentTwo", { "slots": { "NAME": "LITERAL", diff --git a/test/test_alexa_integration_express.js b/test/test_alexa_integration_express.js index 5f54bd8..7af4c6e 100644 --- a/test/test_alexa_integration_express.js +++ b/test/test_alexa_integration_express.js @@ -24,7 +24,7 @@ describe("Alexa", function() { var testServer; var testApp; - beforeEach(() => { + beforeEach(function() { app = express(); app.use(bodyParser.json()); app.set('views', path.join(__dirname, 'views')); @@ -33,12 +33,12 @@ describe("Alexa", function() { testServer = app.listen(3000); }); - afterEach(() => { + afterEach(function() { testServer.close(); }); context("#express with default options", function() { - beforeEach(() => { + beforeEach(function() { testApp.express(app, '/') }); @@ -72,7 +72,7 @@ describe("Alexa", function() { }); context("#express with debug set to true", function() { - beforeEach(() => { + beforeEach(function() { testApp.express(app, '/', true) }); @@ -86,7 +86,7 @@ describe("Alexa", function() { }); context("#express with debug set to false", function() { - beforeEach(() => { + beforeEach(function() { testApp.express(app, '/', false) }); diff --git a/test/test_alexa_integration_lambda.js b/test/test_alexa_integration_lambda.js index df6cefd..af78b24 100644 --- a/test/test_alexa_integration_lambda.js +++ b/test/test_alexa_integration_lambda.js @@ -15,7 +15,7 @@ describe("Alexa", function() { describe("app", function() { var testApp; - beforeEach(() => { + beforeEach(function() { testApp = new Alexa.app("testApp"); });