diff --git a/README.md b/README.md index 44ee539..ba7c48d 100644 --- a/README.md +++ b/README.md @@ -1540,15 +1540,24 @@ The included `make.cmd` script will build `xlsx.js` from the `bits` directory. Building is as simple as: ```cmd -> make.cmd +> make ``` To prepare dev environment: ```cmd -> npm install -g mocha -> npm install -> mocha -t 30000 +> make init +``` + +The full list of commands available in Windows are displayed in `make help`: + +``` +make init -- install deps and global modules +make lint -- run eslint linter +make test -- run mocha test suite +make misc -- run smaller test suite +make book -- rebuild README and summary +make help -- display this message ``` The normal approach uses a variety of command line tools to grab the test files. diff --git a/docbits/95_contrib.md b/docbits/95_contrib.md index 9e029c8..9a6e1ed 100644 --- a/docbits/95_contrib.md +++ b/docbits/95_contrib.md @@ -26,15 +26,24 @@ The included `make.cmd` script will build `xlsx.js` from the `bits` directory. Building is as simple as: ```cmd -> make.cmd +> make ``` To prepare dev environment: ```cmd -> npm install -g mocha -> npm install -> mocha -t 30000 +> make init +``` + +The full list of commands available in Windows are displayed in `make help`: + +``` +make init -- install deps and global modules +make lint -- run eslint linter +make test -- run mocha test suite +make misc -- run smaller test suite +make book -- rebuild README and summary +make help -- display this message ``` The normal approach uses a variety of command line tools to grab the test files. diff --git a/make.cmd b/make.cmd index 9af8589..99f04fa 100644 --- a/make.cmd +++ b/make.cmd @@ -1,2 +1,30 @@ -type bits\* > xlsx.flow.js -node misc\strip_flow.js > xlsx.js +@echo off +REM vim: set ts=2: + +if "%1" == "help" ( + echo make init -- install deps and global modules + echo make lint -- run eslint linter + echo make test -- run mocha test suite + echo remember to download the test_files release! + echo make misc -- run smaller test suite + echo make book -- rebuild README and summary + echo make help -- display this message +) else if "%1" == "init" ( + npm install + npm install -g eslint eslint-plugin-html eslint-plugin-json + npm install -g mocha markdown-toc +) else if "%1" == "lint" ( + eslint --ext .js,.njs,.json,.html,.htm xlsx.js xlsx.flow.js bin/xlsx.njs package.json bower.json +) else if "%1" == "test" ( + SET FMTS= + mocha -R spec -t 30000 +) else if "%1" == "misc" ( + SET FMTS=misc + mocha -R spec -t 30000 +) else if "%1" == "book" ( + type docbits\*.md > README.md + markdown-toc -i README.md +) else ( + type bits\*.js > xlsx.flow.js + node misc\strip_flow.js > xlsx.js +) diff --git a/test.js b/test.js index af7afa1..f0f7d37 100644 --- a/test.js +++ b/test.js @@ -19,8 +19,8 @@ if(process.env.FMTS) ex=process.env.FMTS.split(":").map(function(x){return x[0]= var exp = ex.map(function(x){ return x + ".pending"; }); function test_file(x){ return ex.indexOf(x.substr(-5))>=0||exp.indexOf(x.substr(-13))>=0 || ex.indexOf(x.substr(-4))>=0||exp.indexOf(x.substr(-12))>=0; } -var files = (fs.existsSync('tests.lst') ? fs.readFileSync('tests.lst', 'utf-8').split("\n") : fs.readdirSync('test_files')).filter(test_file); -var fileA = (fs.existsSync('testA.lst') ? fs.readFileSync('testA.lst', 'utf-8').split("\n") : []).filter(test_file); +var files = (fs.existsSync('tests.lst') ? fs.readFileSync('tests.lst', 'utf-8').split("\n").map(function(x) { return x.trim(); }) : fs.readdirSync('test_files')).filter(test_file); +var fileA = (fs.existsSync('testA.lst') ? fs.readFileSync('testA.lst', 'utf-8').split("\n").map(function(x) { return x.trim(); }) : []).filter(test_file); /* Excel enforces 31 character sheet limit, although technical file limit is 255 */ function fixsheetname(x) { return x.substr(0,31); } @@ -987,6 +987,7 @@ describe('parse features', function() { describe('page margins', function() { var wb1, wb2, wb3, wb4, wb5, wbs; var bef = (function() { + if(!fs.existsSync(paths.pmxls)) return wbs=[]; wb1 = X.readFile(paths.pmxls); wb2 = X.readFile(paths.pmxls5); wb3 = X.readFile(paths.pmxml); @@ -1251,7 +1252,7 @@ describe('roundtrip features', function() { }); }); - describe('should preserve page margins', function() {[ + (fs.existsSync(paths.pmxlsx) ? describe : describe.skip)('should preserve page margins', function() {[ //['xlml', paths.pmxml], ['xlsx', paths.pmxlsx], ['xlsb', paths.pmxlsb] @@ -1654,7 +1655,7 @@ describe('encryption', function() { describe('multiformat tests', function() { var mfopts = opts; -var mft = fs.readFileSync('multiformat.lst','utf-8').split("\n"); +var mft = fs.readFileSync('multiformat.lst','utf-8').split("\n").map(function(x) { return x.trim(); }); var csv = true, formulae = false; mft.forEach(function(x) { if(x[0]!="#") describe('MFT ' + x, function() {