diff --git a/spec/integration/data/huge.xlsx b/spec/integration/data/huge.xlsx new file mode 100644 index 000000000..20934cba9 Binary files /dev/null and b/spec/integration/data/huge.xlsx differ diff --git a/spec/integration/workbook-xlsx-reader.spec.js b/spec/integration/workbook-xlsx-reader.spec.js index 1909f2f42..f98ba3cfe 100644 --- a/spec/integration/workbook-xlsx-reader.spec.js +++ b/spec/integration/workbook-xlsx-reader.spec.js @@ -37,6 +37,17 @@ describe('WorkbookReader', function() { }); }); + it('should fail fast on a huge file', function() { + this.timeout(1000); + var workbook = new Excel.Workbook(); + return workbook.xlsx.readFile('./spec/integration/data/huge.xlsx', {maxRows: 100}) + .then(function() { + throw new Error('Promise unexpectedly fulfilled'); + }, function(err) { + expect(err.message).to.equal('Max row count exceeded'); + }); + }); + it('should parse fine if the limit is not exceeded', function() { var workbook = new Excel.Workbook(); return workbook.xlsx.readFile('./spec/integration/data/fibonacci.xlsx', {maxRows: 20});