Skip to content
This repository has been archived by the owner on Dec 5, 2017. It is now read-only.

Commit

Permalink
version bump 0.3.1: XLSX 0.7.1, XLS 0.6.18
Browse files Browse the repository at this point in the history
added coverage tests + coveralls
  • Loading branch information
SheetJSDev committed May 18, 2014
1 parent 17f5ff9 commit 43e7361
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
test_files/
misc/coverage.html
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ node_js:
- "0.8"
before_install:
- "npm install -g mocha"
- "npm install blanket"
- "npm install coveralls mocha-lcov-reporter"
before_script:
- "make init"
after_success:
- "make coveralls-spin"
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FMT=xls xml xlsx xlsm xlsb misc
.PHONY: init
init:
bash init.sh


.PHONY: test mocha
test mocha: test.js
Expand All @@ -9,11 +13,27 @@ TESTFMT=$(patsubst %,test_%,$(FMT))
$(TESTFMT): test_%:
FMTS=$* make test

.PHONY: init
init:
bash init.sh

.PHONY: lint
lint: $(TARGET)
jshint --show-non-errors $(TARGET)

.PHONY: cov cov-spin
cov: misc/coverage.html
cov-spin:
make cov & bash misc/spin.sh $$!

COVFMT=$(patsubst %,cov_%,$(FMT))
.PHONY: $(COVFMT)
$(COVFMT): cov_%:
FMTS=$* make cov

misc/coverage.html: $(TARGET) test.js
mocha --require blanket -R html-cov > $@

.PHONY: coveralls coveralls-spin
coveralls:
mocha --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js

coveralls-spin:
make coveralls & bash misc/spin.sh $$!
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ Please consult the attached LICENSE file for details. All rights not explicitly

[![Build Status](https://travis-ci.org/SheetJS/j.png?branch=master)](https://travis-ci.org/SheetJS/j)

[![Coverage Status](https://coveralls.io/repos/SheetJS/j/badge.png)](https://coveralls.io/r/SheetJS/j)

## Using J for diffing XLS/XLSB/XLSM/XLSX files

Using git textconv, you can use `J` to generate more meaningful diffs!
Expand Down
6 changes: 0 additions & 6 deletions j.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ function to_xml(w) {
return lst;
}

function to_clit(w, s) {
var t = to_dsv(w, "\u2603","\u2604")[s].split("\u2604").map(function(s) { return s.split("\u2603").map(function(k) { return k.replace(/^"/,"").replace(/"$/,""); }); });
return t;
}

function to_xlsx_factory(t) {
return function(w, o) {
o = o || {}; o.bookType = t;
Expand Down Expand Up @@ -154,7 +149,6 @@ module.exports = {
to_json: to_json,
to_html: to_html,
to_formulae: to_formulae,
to_clit: to_clit,
get_cols: get_cols
},
version: "XLS " + XLS.version + " ; XLSX " + XLSX.version
Expand Down
14 changes: 14 additions & 0 deletions misc/spin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# spin.sh -- show a spinner (for coverage test)
# Copyright (C) 2014 SheetJS

wpid=$1
delay=1
str="|/-\\"
while [ $(ps -a|awk '$1=='$wpid' {print $1}') ]; do
t=${str#?}
printf " [%c]" "$str"
str=$t${str%"$t"}
sleep $delay
printf "\b\b\b\b"
done
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "j",
"version": "0.3.0",
"version": "0.3.1",
"author": "sheetjs",
"description": "data wrangler",
"keywords": [ "xls", "xlsx", "xlsm", "xlsb", "office", "excel", "spreadsheet" ],
Expand All @@ -9,7 +9,7 @@
},
"main": "./j",
"dependencies": {
"xlsjs": "~0.6.17",
"xlsjs": "~0.6.18",
"xlsx": "~0.7.1",
"commander":""
},
Expand All @@ -20,6 +20,11 @@
"scripts": {
"test": "make mocha"
},
"config": {
"blanket": {
"pattern": "[./j.js,./node_modules/xlsjs/xls.js,./node_modules/xlsx/xlsx.js]"
}
},
"bugs": { "url": "https://github.com/SheetJS/j/issues" },
"license": "Apache-2.0",
"engines": { "node": ">=0.8" }
Expand Down
14 changes: 10 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ var dir = "./test_files/";
files.forEach(function(x) {
if(fs.existsSync(dir + x.replace(/\.(pending|nowrite)/, ""))) describe(x.replace(/\.pending/,""), function() {
var wb, wbxlsx, wbxlsm, wbxlsb;
before(function() { if(x.substr(-8) !== ".pending") wb = J.readFile(dir + x, opts); });
before(function() { if(x.substr(-8) !== ".pending") wb = J.readFile(dir + x.replace(/\.nowrite/,""), opts); });
it('should parse', x.substr(-8) == ".pending" ? null : function() {});

it('should generate files', x.substr(-8) == ".pending" ? null : function() {
J.utils.to_formulae(wb);
J.utils.to_json(wb, true);
J.utils.to_json(wb, false);
J.utils.to_dsv(wb,",", "\n");
J.utils.to_html(wb);
J.utils.to_xml(wb);
});
it('should round-trip XLSX', x.substr(-8) == ".pending" || x.substr(-8) == ".nowrite" ? null : function() {
fs.writeFileSync(dir + x + "__.xlsx", J.utils.to_xlsx(wb, {}));
wbxlsx = J.readFile(dir + x + "__.xlsx", opts);
Expand Down Expand Up @@ -51,10 +58,9 @@ mft.forEach(function(x) { if(x[0]!="#") describe('MFT ' + x, function() {
it('should have the same sheetnames', function() {
cmparr(f.map(function(x) { return x[1].SheetNames; }));
});
it.skip('should have the same ranges', function() {
it('should have the same ranges', function() {
f[0][1].SheetNames.forEach(function(s) {
var ss = f.map(function(x) { return x[1].Sheets[s]; });
console.log(ss.map(function(s) { return s['!ref']; }));
cmparr(ss.map(function(s) { return s['!ref']; }));
});
});
Expand Down

0 comments on commit 43e7361

Please sign in to comment.