Skip to content

Commit 0e2e309

Browse files
authored
Merge pull request screepers#124 from screepers/int-test-cleanup
Integration testing cleanup
2 parents bfb6d29 + b3d7bda commit 0e2e309

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ You will need:
88

99
- [Node.JS](https://nodejs.org/en/download) (>= 8.0.0)
1010
- A Package Manager ([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node))
11-
- Rollup CLI (Optional, install via `npm install -g rollup`)
12-
- Build tools (`apt install build-essential` for Ubuntu, [Visual Studio](https://www.visualstudio.com/vs/) for Windows, etc)
13-
11+
- Rollup CLI (Optional, install via `npm install -g rollup`)
1412

1513
Download the latest source [here](https://github.com/screepers/screeps-typescript-starter/archive/master.zip) and extract it to a folder.
1614

docs/in-depth/testing.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,40 @@ magnitude, it is recommended to prefer unit tests wherever possible.
4242

4343
## Integration Testing
4444

45+
### Installing Screeps Server Mockup
46+
47+
Before starting to use integration testing, you must install [screeps-server-mockup](https://github.com/screepers/screeps-server-mockup) to your project.
48+
Please view that repository for more instruction on installation.
49+
50+
```bash
51+
# Using yarn:
52+
yarn add -D screeps-server-mockup
53+
# Using npm
54+
npm install --save-dev screeps-server-mockup
55+
```
56+
57+
You will also need to add scripts to run integration tests.
58+
59+
In `package.json`, add a new `test-integration` script and add the new integration testing to the main `test` script.
60+
61+
```json
62+
"scripts": {
63+
"test": "npm run test-unit && npm run test-integration",
64+
"test-integration": "npm run build && rollup -c rollup.test-integration-config.js && mocha dist/test-integration.bundle.js",
65+
}
66+
```
67+
68+
Now you can run integration tests by using the `test-integration` script or run both unit and integration tests using the `test` script.
69+
70+
### Integration Testing with Screeps Server Mockup
71+
4572
Integration testing is for code that depends heavily on having a full game
4673
environment. Integration tests are completely representative of the real game
4774
(in fact they run with an actual Screeps server). This comes at the cost of
4875
performance and very involved setup when creating specific scenarios.
4976

50-
Server testing support is implmented via
51-
[screeps-server-mockup](https://github.com/Hiryus/screeps-server-mockup). View
77+
Server testing support is implemented via
78+
[screeps-server-mockup](https://github.com/screepers/screeps-server-mockup). View
5279
this repository for more information on the API.
5380

5481
By default the test helper will create a "stub" world with a 3x3 grid of rooms

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"push-main": "rollup -c --environment DEST:main",
1111
"push-pserver": "rollup -c --environment DEST:pserver",
1212
"push-sim": "rollup -c --environment DEST:sim",
13-
"test": "npm run test-unit && npm run test-integration",
13+
"test": "npm run test-unit",
1414
"test-unit": "rollup -c rollup.test-unit-config.js && mocha dist/test-unit.bundle.js",
15-
"test-integration": "npm run build && rollup -c rollup.test-integration-config.js && mocha dist/test-integration.bundle.js",
15+
"test-integration": "echo 'See docs/in-depth/testing.md for instructions on enabling integration tests'",
1616
"watch-main": "rollup -cw --environment DEST:main",
1717
"watch-pserver": "rollup -cw --environment DEST:pserver",
1818
"watch-sim": "rollup -cw --environment DEST:sim"

0 commit comments

Comments
 (0)