From c1fc4862253bae45a75d644eaee57e553d017df7 Mon Sep 17 00:00:00 2001 From: Evgeny Bondarenko Date: Thu, 9 Mar 2017 17:17:03 +0300 Subject: [PATCH] src: Load transpiled code for Node 5 References: * Bug-Report #297: https://github.com/yagop/node-telegram-bot-api/issues/297 * Bug-Report-by: @jehy * PR #298: https://github.com/yagop/node-telegram-bot-api/pull/298 * PR-by: @jehy --- index.js | 8 ++++---- test/telegram.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 8e0c99b..5743a57 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,12 @@ /** - * If running on Nodejs 4.x and below, we load the transpiled code. + * If running on Nodejs 5.x and below, we load the transpiled code. * Otherwise, we use the ES6 code. - * We are deprecating support for Node.js v4.x and below. + * We are deprecating support for Node.js v5.x and below. */ const majorVersion = parseInt(process.versions.node.split('.')[0], 10); -if (majorVersion <= 4) { +if (majorVersion <= 5) { const deprecate = require('depd')('node-telegram-bot-api'); - deprecate('Node.js v4.x and below will no longer be supported in the future'); + deprecate('Node.js v5.x and below will no longer be supported in the future'); module.exports = require('./lib/telegram'); } else { module.exports = require('./src/telegram'); diff --git a/test/telegram.js b/test/telegram.js index 288fe02..eac08a9 100644 --- a/test/telegram.js +++ b/test/telegram.js @@ -49,12 +49,12 @@ before(function beforeAll() { describe('module.exports', function moduleExportsSuite() { const nodeVersion = parseInt(process.versions.node.split('.')[0], 10); - it('is loaded from src/ on Node.js v5+ and above', function test() { - if (nodeVersion <= 4) this.skip(); // skip on Node.js v4 and below + it('is loaded from src/ on Node.js v6+ and above', function test() { + if (nodeVersion <= 5) this.skip(); // skip on Node.js v5 and below assert.equal(TelegramBot, require('../src/telegram')); }); - it('is loaded from lib/ on Node.js v4 and below', function test() { - if (nodeVersion > 4) this.skip(); // skip on newer versions + it('is loaded from lib/ on Node.js v5 and below', function test() { + if (nodeVersion > 5) this.skip(); // skip on newer versions assert.equal(TelegramBot, require('../lib/telegram')); }); });