diff --git a/.gitignore b/.gitignore
index 118517ba..fb8b79dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@ npm-debug.log*
modules/fancybox/lib/
modules/jquery/src
modules/fancybox/demo
+
+.nyc_output
diff --git a/.travis.yml b/.travis.yml
index 268c1430..0997b727 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,8 @@ node_js:
- 0.12
script:
- - npm test
+ - npm codestyle
+ - npm run coverage && npm run report
notifications:
email:
diff --git a/package.json b/package.json
index dd6636b5..299af22a 100644
--- a/package.json
+++ b/package.json
@@ -30,17 +30,19 @@
},
"scripts": {
"start": "node bin/cloudcmd.js",
- "test": "npm-run-all --parallel lint:* codestyle spell mocha",
+ "codestyle": "npm-run-all --parallel lint:* jscs spell",
"lint:css": "recess css/*.css",
"lint:js": "jshint $npm_package_config_dirs",
- "codestyle": "jscs --esnext $npm_package_config_dirs",
- "mocha": "mocha test/lib",
+ "jscs": "jscs --esnext $npm_package_config_dirs",
+ "test": "tape test/**/*.js",
"spell": "yaspeller .",
"wisdom": "bin/release.js",
"docker:pull": "docker pull coderaiser/cloudcmd:v`version`",
"docker:tag": "docker tag coderaiser/cloudcmd:latest coderaiser/cloudcmd:`version`",
"docker:push": "docker push coderaiser/cloudcmd:`version`",
- "docker": "npm-run-all docker:pull docker:tag docker:push"
+ "docker": "npm-run-all docker:pull docker:tag docker:push",
+ "coverage": "nyc npm test",
+ "report": "nyc report --reporter=text-lcov | coveralls"
},
"directories": {
"man": "man"
@@ -84,16 +86,17 @@
"writejson": "~1.1.0"
},
"devDependencies": {
+ "coveralls": "^2.11.6",
"jscs": "^2.7.0",
"jshint": "^2.8.0",
"minor": "^1.2.2",
- "mocha": "^2.3.4",
"morgan": "^1.6.1",
"npm-run-all": "^1.4.0",
+ "nyc": "^5.6.0",
"place": "^1.1.4",
"recess": "^1.1.9",
"shortdate": "^1.0.1",
- "should": "^8.0.0",
+ "tape": "^4.4.0",
"version-io": "^1.2.5",
"yaspeller": "^2.6.0"
},
diff --git a/test/lib/cloudfunc.html b/test/lib/cloudfunc.html
index 9deb1d22..94076440 100644
--- a/test/lib/cloudfunc.html
+++ b/test/lib/cloudfunc.html
@@ -2,24 +2,28 @@
name
size
+ date
owner
mode
-
..
<dir>
+ --.--.----
.
--- --- ---
-
applnk
<dir>
+ 21.02.2016
root
rwx r-x r-x
-
prefdm
1.30kb
+ 21.02.2016
root
rwx r-x r-x
\ No newline at end of file
diff --git a/test/lib/cloudfunc.js b/test/lib/cloudfunc.js
index 54e58283..5aa886c1 100644
--- a/test/lib/cloudfunc.js
+++ b/test/lib/cloudfunc.js
@@ -1,8 +1,6 @@
(function() {
'use strict';
- /* global describe, it */
-
var DIR = __dirname + '/../../',
LIBDIR = DIR + 'lib/',
TMPLDIR = DIR + 'tmpl/',
@@ -12,6 +10,8 @@
files = require('files-io'),
rendy = require('rendy'),
+ test = require('tape'),
+
FS_DIR = TMPLDIR + 'fs/',
EXPECT_PATH = DIR + 'test/lib/cloudfunc.html',
@@ -27,11 +27,13 @@
files : [{
name: 'applnk',
size: 'dir',
+ date: '21.02.2016',
uid : 0,
mode: 'rwx r-x r-x'
}, {
name: 'prefdm',
size: '1.30kb',
+ date: '21.02.2016',
uid : 0,
mode: 'rwx r-x r-x'
}]
@@ -51,15 +53,9 @@
'/X11/' +
'' +
'';
-
- describe('cloudfunc', function() {
- it('should check', function() {
- check();
- });
- });
- function check() {
- var paths = {},
+ test(function(t) {
+ var paths = {},
filesList = TMPL_PATH.map(function(name) {
var path = FS_DIR + name + '.hbs';
@@ -119,9 +115,14 @@
result: result.substr(i)
}));
- throw('buildFromJSON: Not OK');
+ console.log('buildFromJSON: Not OK');
}
+
+ t.equal(Expect, result, 'should be equal rendered json data');
+
+ t.end();
}
});
- }
+ });
+
})();
diff --git a/test/lib/util.js b/test/lib/util.js
index 7e760c76..dde65b2c 100644
--- a/test/lib/util.js
+++ b/test/lib/util.js
@@ -1,30 +1,27 @@
(function() {
'use strict';
- /*global describe, it */
-
- var should = require('should'),
+ var test = require('tape'),
DIR = '../../',
Util = require(DIR + 'lib/util');
- describe('Util', function() {
- describe('getExt', function() {
- it('should return "" when extension is none', function() {
- var EXT = '',
- name = 'file-withot-extension',
- ext = Util.getExt(name);
-
- should(ext).eql(EXT);
- });
-
- it('should return ".png" in files "picture.png"', function() {
- var EXT = '.png',
- name = 'picture.png',
- ext = Util.getExt(name);
-
- should(ext).eql(EXT);
- });
- });
+
+ test('getExt: no extension', function(t) {
+ var EXT = '',
+ name = 'file-withot-extension',
+ ext = Util.getExt(name);
+
+ t.equal(ext, EXT, 'should return "" when extension is none');
+ t.end();
+ });
+
+ test('getExt: return extension', function(t) {
+ var EXT = '.png',
+ name = 'picture.png',
+ ext = Util.getExt(name);
+
+ t.equal(ext, EXT, 'should return ".png" in files "picture.png"');
+ t.end();
});
})();
diff --git a/tmpl/fs/file.hbs b/tmpl/fs/file.hbs
index 34c0197e..0eaa6887 100644
--- a/tmpl/fs/file.hbs
+++ b/tmpl/fs/file.hbs
@@ -2,7 +2,7 @@
{{ name }}
{{ size }}
- {{ date }}
+ {{ date }}
{{ owner }}
{{ mode }}
{{ tag }}>
\ No newline at end of file