Skip to content

Commit 4443786

Browse files
committed
feat: start + port command shortcut, close #23
1 parent 78befaa commit 4443786

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ script:
1515
- npm run demo2
1616
- npm run demo3
1717
- npm run demo4
18+
- npm run demo5
1819
after_success:
1920
- npm run travis-deploy-once "npm run semantic-release"
2021
branches:

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ You can also shorten local url to just port
6363
}
6464
```
6565

66+
You can provide first start command, port (or url) and implicit `test` command
67+
68+
```json
69+
{
70+
"scripts": {
71+
"start-it": "npm start",
72+
"test": "mocha e2e-spec.js",
73+
"ci": "server-test start-it 8080"
74+
}
75+
}
76+
```
77+
6678
## Note for webpack-dev-server users
6779

6880
If you are using [webpack-dev-server](https://www.npmjs.com/package/webpack-dev-server) (directly or via `angular/cli` or other boilerplates) then please use the following URL form to check

bin/start.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ if (args.length === 1 && utils.isUrlOrPort(args[0])) {
1313
// passed just single url or port number, for example
1414
// "start": "http://localhost:8080"
1515
url = utils.normalizeUrl(args[0])
16+
} else if (args.length === 2 && utils.isUrlOrPort(args[1])) {
17+
// passed start command and url/port
18+
// like "start-server 8080"
19+
start = args[0]
20+
url = utils.normalizeUrl(args[1])
1621
} else {
1722
la(args.length === 3, 'expect: <start script name> <url> <test script name>')
1823
start = args[0]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"demo2": "node bin/start.js start http://127.0.0.1:9000 test2",
8080
"demo3": "node bin/start.js start-with-child http://127.0.0.1:9000 test",
8181
"demo4": "node bin/start.js 9000",
82+
"demo5": "node bin/start.js start-with-child 9000",
8283
"travis-deploy-once": "travis-deploy-once"
8384
},
8485
"devDependencies": {

0 commit comments

Comments
 (0)