2017-03-20 09:02:25 +00:00
|
|
|
## Testing
|
|
|
|
|
2017-04-13 07:08:46 +00:00
|
|
|
### Node
|
|
|
|
|
2017-04-30 20:37:53 +00:00
|
|
|
<details>
|
|
|
|
<summary>(click to show)</summary>
|
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
`make test` will run the node-based tests. By default it runs tests on files in
|
|
|
|
every supported format. To test a specific file type, set `FMTS` to the format
|
|
|
|
you want to test. Feature-specific tests are avaialble with `make test_misc`
|
|
|
|
|
|
|
|
```bash
|
2017-04-13 07:08:46 +00:00
|
|
|
$ make test_misc # run core tests
|
2017-03-20 09:02:25 +00:00
|
|
|
$ make test # run full tests
|
|
|
|
$ make test_xls # only use the XLS test files
|
|
|
|
$ make test_xlsx # only use the XLSX test files
|
|
|
|
$ make test_xlsb # only use the XLSB test files
|
2017-04-13 07:08:46 +00:00
|
|
|
$ make test_xml # only use the XML test files
|
|
|
|
$ make test_ods # only use the ODS test files
|
2017-03-20 09:02:25 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
To enable all errors, set the environment variable `WTF=1`:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ make test # run full tests
|
|
|
|
$ WTF=1 make test # enable all error messages
|
|
|
|
```
|
|
|
|
|
2017-04-30 20:37:53 +00:00
|
|
|
Flow and eslint checks are available:
|
2017-03-20 09:02:25 +00:00
|
|
|
|
|
|
|
```bash
|
2017-04-30 20:37:53 +00:00
|
|
|
$ make lint # eslint checks
|
2017-03-20 09:02:25 +00:00
|
|
|
$ make flow # make lint + Flow checking
|
|
|
|
```
|
|
|
|
|
2017-04-30 20:37:53 +00:00
|
|
|
</details>
|
|
|
|
|
2017-04-13 07:08:46 +00:00
|
|
|
### Browser
|
|
|
|
|
2017-04-30 20:37:53 +00:00
|
|
|
<details>
|
|
|
|
<summary>(click to show)</summary>
|
|
|
|
|
2017-04-13 07:08:46 +00:00
|
|
|
The core in-browser tests are available at `tests/index.html` within this repo.
|
2017-03-20 21:42:12 +00:00
|
|
|
Start a local server and navigate to that directory to run the tests.
|
2017-04-13 07:08:46 +00:00
|
|
|
`make ctestserv` will start a server on port 8000.
|
|
|
|
|
|
|
|
`make ctest` will generate the browser fixtures. To add more files, edit the
|
|
|
|
`tests/fixtures.lst` file and add the paths.
|
2017-03-20 21:42:12 +00:00
|
|
|
|
|
|
|
To run the full in-browser tests, clone the repo for
|
2017-03-20 09:02:25 +00:00
|
|
|
[oss.sheetjs.com](https://github.com/SheetJS/SheetJS.github.io) and replace
|
|
|
|
the xlsx.js file (then fire up the browser and go to `stress.html`):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ cp xlsx.js ../SheetJS.github.io
|
|
|
|
$ cd ../SheetJS.github.io
|
|
|
|
$ simplehttpserver # or "python -mSimpleHTTPServer" or "serve"
|
|
|
|
$ open -a Chromium.app http://localhost:8000/stress.html
|
|
|
|
```
|
2017-04-30 20:37:53 +00:00
|
|
|
</details>
|
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
### Tested Environments
|
|
|
|
|
2017-05-09 18:07:57 +00:00
|
|
|
<details>
|
|
|
|
<summary>(click to show)</summary>
|
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
- NodeJS 0.8, 0.9, 0.10, 0.11, 0.12, 4.x, 5.x, 6.x, 7.x
|
|
|
|
- IE 6/7/8/9/10/11 (IE6-9 browsers require shims for interacting with client)
|
|
|
|
- Chrome 24+
|
|
|
|
- Safari 6+
|
|
|
|
- FF 18+
|
|
|
|
|
|
|
|
Tests utilize the mocha testing framework. Travis-CI and Sauce Labs links:
|
|
|
|
|
|
|
|
- <https://travis-ci.org/SheetJS/js-xlsx> for XLSX module in nodejs
|
|
|
|
- <https://semaphoreci.com/sheetjs/js-xlsx> for XLSX module in nodejs
|
|
|
|
- <https://travis-ci.org/SheetJS/SheetJS.github.io> for XLS\* modules
|
|
|
|
- <https://saucelabs.com/u/sheetjs> for XLS\* modules using Sauce Labs
|
|
|
|
|
2017-05-09 18:07:57 +00:00
|
|
|
</details>
|
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
### Test Files
|
|
|
|
|
|
|
|
Test files are housed in [another repo](https://github.com/SheetJS/test_files).
|
|
|
|
|
|
|
|
Running `make init` will refresh the `test_files` submodule and get the files.
|
2017-05-16 17:45:35 +00:00
|
|
|
Note that this requires `svn`, `git`, `hg` and other commands that may not be
|
|
|
|
available. If `make init` fails, please download the latest version of the test
|
|
|
|
files snapshot from [the repo](https://github.com/SheetJS/test_files/releases)
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
<details>
|
|
|
|
<summary><b>Latest Snapshot</b> (click to show)</summary>
|
|
|
|
|
|
|
|
Latest test files snapshot:
|
|
|
|
<http://github.com/SheetJS/test_files/releases/download/20170409/test_files.zip>
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
(download and unzip to the `test_files` subdirectory)
|
|
|
|
|
|
|
|
</details>
|
2017-03-20 09:02:25 +00:00
|
|
|
|