Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rewrite tests to `mocha`, use `mocha-istanbul` coverage reporter

  • Loading branch information...
commit b2f37e873a5f8f723c942ed31371b4e0ce9e6ce3 1 parent 2a0c0f6
@arikon arikon authored
View
1  .gitignore
@@ -2,3 +2,4 @@
*.iml
node_modules/
lib-cov/
+html-report/
View
4 GNUmakefile
@@ -13,11 +13,11 @@ lib/%.js: src/%.coffee
.PHONY: test
test: lib
- $(BIN)/vows --spec
+ $(BIN)/mocha
.PHONY: coverage
coverage: lib-cov
- COVER=1 $(BIN)/vows --spec
+ COVER=1 $(BIN)/mocha --reporter mocha-istanbul
.PHONY: watch
watch:
View
7 package.json
@@ -24,7 +24,12 @@
"devDependencies": {
"coffee-script": "~1.4.0",
"istanbul": "~0.1.11",
- "vows": "~0.6.4"
+ "mocha-istanbul": "*",
+ "mocha": "~1.6.0"
+ },
+ "scripts": {
+ "test": "make test",
+ "coverage": "make coverage"
},
"engines": {
"node": ">= 0.6.0"
View
3  test/mocha.opts
@@ -0,0 +1,3 @@
+--reporter spec
+--ignore-leaks
+--timeout 0
View
83 test/shell-test.js
@@ -1,59 +1,60 @@
-var vows = require('vows'),
- assert = require('assert'),
+var assert = require('chai').assert,
shell = require('..').shell;
-vows.describe('coa/shell').addBatch({
+/**
+ * Mocha BDD interface.
+ */
+/** @name describe @function */
+/** @name it @function */
+/** @name before @function */
+/** @name after @function */
+/** @name beforeEach @function */
+/** @name afterEach @function */
- 'The shell module': {
+describe('shell', function() {
- '`escape`': {
+ describe('escape()', function() {
- topic: function() {
- return shell.escape;
- },
+ var escape = shell.escape;
- 'Should wrap values with spaces in double quotes': function(escape) {
- assert.equal(escape('asd abc'), '"asd abc"');
- },
+ it('Should wrap values with spaces in double quotes', function() {
+ assert.equal(escape('asd abc'), '"asd abc"');
+ });
- 'Should escape double quote "': function(escape) {
- assert.equal(escape('"asd'), '\\"asd');
- },
+ it('Should escape double quote "', function() {
+ assert.equal(escape('"asd'), '\\"asd');
+ });
- "Should escape single quote '": function(escape) {
- assert.equal(escape("'asd"), "\\'asd");
- },
+ it("Should escape single quote '", function() {
+ assert.equal(escape("'asd"), "\\'asd");
+ });
- 'Should escape backslash \\': function(escape) {
- assert.equal(escape('\\asd'), '\\\\asd');
- },
+ it('Should escape backslash \\', function() {
+ assert.equal(escape('\\asd'), '\\\\asd');
+ });
- 'Should escape dollar $': function(escape) {
- assert.equal(escape('$asd'), '\\$asd');
- },
+ it('Should escape dollar $', function() {
+ assert.equal(escape('$asd'), '\\$asd');
+ });
- 'Should escape backtick `': function(escape) {
- assert.equal(escape('`asd'), '\\`asd');
- }
+ it('Should escape backtick `', function() {
+ assert.equal(escape('`asd'), '\\`asd');
+ });
- },
+ });
- '`unescape`': {
+ describe('unescape()', function() {
- topic: function() {
- return shell.unescape;
- },
+ var unescape = shell.unescape;
- 'Should strip double quotes at the both ends': function(unescape) {
- assert.equal(unescape('"asd"'), 'asd');
- },
+ it('Should strip double quotes at the both ends', function() {
+ assert.equal(unescape('"asd"'), 'asd');
+ });
- 'Should not strip escaped double quotes at the both ends': function(unescape) {
- assert.equal(unescape('\\"asd\\"'), '"asd"');
- }
+ it('Should not strip escaped double quotes at the both ends', function() {
+ assert.equal(unescape('\\"asd\\"'), '"asd"');
+ });
- }
+ });
- }
-
-}).export(module);
+});
Please sign in to comment.
Something went wrong with that request. Please try again.