docs.sheetjs.com/docz/docs/09-miscellany/04-testing.md

136 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

2022-05-16 03:26:04 +00:00
---
title: Testing
2022-06-21 12:26:53 +00:00
sidebar_position: 4
2022-05-16 03:26:04 +00:00
hide_table_of_contents: true
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-07-18 22:19:02 +00:00
SheetJS libraries have extensive test suites.
### Local Tests
<Tabs groupId="plat">
2022-05-16 03:26:04 +00:00
<TabItem value="nodejs" label="NodeJS">
`make test` will run the NodeJS tests. By default it runs tests on files in
every supported format. To test a specific file type, set `FMTS` to the desired
file extension. Feature-specific tests are available with `make test_misc`.
2022-05-16 03:26:04 +00:00
```bash
$ make test_misc # run core tests
$ make test # run full tests
```
To enable all errors, set the environment variable `WTF=1`:
```bash
$ make test # run full tests
$ WTF=1 make test # enable all error messages
```
`flow` and `eslint` checks are available:
```bash
$ make lint # eslint checks
$ make tslint # check TS definitions
```
</TabItem>
<TabItem value="browser" label="Browser">
The core in-browser tests are available at `tests/index.html` within this repo.
Start a local server and navigate to that directory to run the tests.
`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.
2022-07-23 09:06:31 +00:00
</TabItem>
<TabItem value="bun" label="Bun">
`make test-bun` will run the full Bun test suite and `make test-bun_misc`
will run the smaller feature-specific tests.
2022-05-16 03:26:04 +00:00
</TabItem>
<TabItem value="deno" label="Deno">
`make test-deno` will run the full Deno test suite and `make test-deno_misc`
will run the smaller feature-specific tests.
2022-05-20 03:25:45 +00:00
</TabItem>
2023-04-19 20:03:23 +00:00
<TabItem value="extendscript" label="ExtendScript">
2022-05-20 03:25:45 +00:00
`make dist` will build `xlsx.extendscript.js`.
The script `estk.jsx` at the root of the project is configured to run in
ExtendScript Toolkit. It will read `sheetjs.xlsx` and attempt to write test
files in a number of file formats.
ExtendScript Toolkit 3.5 is available as a standalone download for Windows.
2022-05-16 03:26:04 +00:00
</TabItem>
</Tabs>
### Tested Environments
<details>
<summary>(click to show)</summary>
2022-11-07 10:41:00 +00:00
**Browsers**
2022-05-16 03:26:04 +00:00
- IE 6/7/8/9/10/11 (IE 6-9 require shims)
2022-11-07 10:41:00 +00:00
- Chrome 26+ (including Android 6.0+)
- Safari 8+ (Desktop) and Safari 10+ (iOS)
- Edge 13-18 and 79+
- FF Latest
2022-05-16 03:26:04 +00:00
2022-11-07 10:41:00 +00:00
The automated browser tests seek to test the latest patch version of each major
release of Chromium ending in `0` (starting from Chrome 30).
2022-05-16 03:26:04 +00:00
2022-11-07 10:41:00 +00:00
Edge originally was an independent browser, becoming a Chromium fork in version
79. Since the new releases should be nearly identical to the Chrome counterpart,
the Edge tests are run on major releases ending in `5` (starting from Edge 85).
2023-04-19 20:03:23 +00:00
**Server Platforms**
2022-11-07 10:41:00 +00:00
- NodeJS `0.8`, `0.10`, `0.12`, and every major version starting from `4`
- io.js 1/2/3
2024-07-18 22:19:02 +00:00
- Bun latest
2022-11-07 10:41:00 +00:00
- Deno latest
2022-05-16 03:26:04 +00:00
2024-07-18 22:19:02 +00:00
The test suite also includes tests for various time zones. Timezones can be
controlled by setting the `TZ` environment variable:
2022-05-16 03:26:04 +00:00
```bash
2023-06-25 19:57:03 +00:00
env TZ="Asia/Kolkata" WTF=1 make test_misc
2022-05-16 03:26:04 +00:00
```
</details>
### Test Files
2024-07-18 22:19:02 +00:00
[Download the test artifacts](https://test-files.sheetjs.com/test_files.zip).
#### Artifact Sources
Test files include derivatives of files from external sources. Files were opened
in various spreadsheet software and exported to CSV and other file formats. The
enclosed `README.md` file explains the naming conventions and file origins.
External sources typically distribute files under open source licenses. Some
sources have dedicated files to the public domain.
It is assumed that external sources have proper authorization to release files
under the asserted license terms. For example, if an external source releases a
file under the Apache 2.0 license, it is assumed that they either generated the
file directly or obtained permission from the creator.
#### Requests for Removal
External sources may have added files from contributors without proper consent.
Users are encouraged to submit reports if files contain private information that
was not properly vetted by the parties that posted the original content.
2022-05-16 03:26:04 +00:00
2024-07-18 22:19:02 +00:00
Please [send an email](mailto:support@sheetjs.com?subject=removal%20request) or
[file an issue in the main source repository](/docs/miscellany/source).