From d8111d17911209189f1dedc5090122140f5e5edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o=20Soares=20dos=20Santos?= Date: Mon, 13 Jul 2015 05:39:05 +0100 Subject: [PATCH] test(cli): run cli tests only on node >= 0.12 --- .travis.yml | 1 + package.json | 1 + test/node/cli.js | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 575e39c..6110552 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - "0.8" - "0.10" + - "0.12" before_install: - '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28' diff --git a/package.json b/package.json index cf4093b..fe2f7b8 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "js-beautify": "^1.5.6", "load-grunt-tasks": "^3.2.0", "quiet-grunt": "^0.2.3", + "semver": "^5.0.0", "sinon": "^1.14.1", "source-map-support": "^0.2.9" }, diff --git a/test/node/cli.js b/test/node/cli.js index aaf4419..36d82e3 100644 --- a/test/node/cli.js +++ b/test/node/cli.js @@ -1,14 +1,16 @@ -var execSync = require('child_process').execSync, - cmd = 'node bin/showdown.js'; +var semver = require('semver'), + cmd = 'node bin/showdown.js'; describe('showdown cli', function () { 'use strict'; - - it('basic stdin stdout', function () { - var otp = execSync(cmd + ' makehtml', { - encoding: 'utf8', - input: '**foo**' + if (semver.gt(process.versions.node, '0.12.0')) { + var execSync = require('child_process').execSync; + it('basic stdin stdout', function () { + var otp = execSync(cmd + ' makehtml', { + encoding: 'utf8', + input: '**foo**' + }); + otp.trim().should.equal('

foo

'); }); - otp.trim().should.equal('

foo

'); - }); + } });