Эх сурвалжийг харах

test(cli): run cli tests only on node >= 0.12

Estevão Soares dos Santos 10 жил өмнө
parent
commit
d8111d1791
3 өөрчлөгдсөн 13 нэмэгдсэн , 9 устгасан
  1. 1 0
      .travis.yml
  2. 1 0
      package.json
  3. 11 9
      test/node/cli.js

+ 1 - 0
.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'

+ 1 - 0
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"
   },

+ 11 - 9
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('<p><strong>foo</strong></p>');
     });
-    otp.trim().should.equal('<p><strong>foo</strong></p>');
-  });
+  }
 });