-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from omochi/doc-test
テストについての書
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Testing | ||
|
||
This project includes two types of tests: | ||
|
||
- [Tests](../Tests): Automatic tests conducted with Swift CLI. | ||
|
||
- [BrowserTests](../BrowserTests): Manual tests conducted in a browser. | ||
|
||
Here's a description of each type: | ||
|
||
## Automatic Tests | ||
|
||
These tests have two execution modes for operating the DOM system under React: | ||
|
||
### Browser Execution Mode via Carton | ||
|
||
Using Carton's testing features, test code compiled into Wasm is connected with the real DOM for testing in a browser. Carton is used solely for its testing capabilities, with the build to Wasm being configured independently. Therefore, preparing the environment is necessary for building: [Setting Up Environment](./configure.md) | ||
|
||
Build and test execution are wrapped in a script, so you use the following command: | ||
|
||
```sh | ||
$ bin/test | ||
``` | ||
|
||
### Host Execution Mode via Swift CLI | ||
|
||
Like a typical Swift Package, you execute tests on the host machine with the following command: | ||
|
||
```sh | ||
$ swift test | ||
``` | ||
|
||
In this mode, tests connect to a mock library that emulates the DOM. The mock consists of the following modules: | ||
|
||
- [JavaScriptKitMock](../Sources/JavaScriptKitMock): This is a mock library that is source-compatible with JavaScriptKit. Rather than connecting to actual JavaScript, it interfaces with objects implemented in Swift. | ||
|
||
- [WebMock](../Sources/WebMock): A mock implementation that performs some of the same functionalities as the DOM API. It complies with the interface of JavaScriptKitMock and can be operated through it. | ||
|
||
## Manual Tests Conducted in a Browser | ||
|
||
[BrowserTests](../BrowserTests) is a project for manually testing Swift React in a browser. Please refer to the linked document for details on how to execute the tests. |