Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit 8b6fbfe

Browse files
authored
Merge pull request #26 from mocks-server/v1.2.0
V1.2.0
2 parents 9bc0836 + c2ada6c commit 8b6fbfe

16 files changed

Lines changed: 941 additions & 116 deletions

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"parser": "flow"
1616
}
1717
],
18+
"no-undef": "error",
1819
"no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
1920
},
2021
"extends": ["prettier"],

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1414
### Fixed
1515
### Removed
1616

17+
## [1.2.0] - 2019-11-13
18+
### Added
19+
- Add api acceptance tests
20+
21+
### Changed
22+
- Upgrade dependencies
23+
24+
### Fixed
25+
- Catch server.listen error and reject start method promise with it when occurs.
26+
1727
## [1.1.1] - 2019-11-12
1828
### Changed
1929
- Change readme. Add links to docs website.

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ module.exports = {
2828
testEnvironment: "node",
2929

3030
// The glob patterns Jest uses to detect test files
31-
testMatch: ["**/test/unit/**/?(*.)+(spec|test).js?(x)"],
31+
testMatch: ["**/test/unit/**/?(*.)+(spec|test).js?(x)"]
3232
//testMatch: ["**/test/unit/**/options.spec.js"]
3333
};

lib/Server.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,25 @@ class Server {
127127
}
128128

129129
startServer(resolve, reject) {
130-
this._server.listen(this._options, error => {
131-
if (error) {
132-
tracer.error(`Error starting server: ${error.message}`);
133-
this._error = error;
134-
reject(error);
135-
} else {
136-
tracer.info(`Server started and listening at http://localhost:${this._options.port}`);
137-
this._error = null;
138-
resolve(this);
139-
}
140-
});
130+
try {
131+
this._server.listen(this._options, error => {
132+
if (error) {
133+
tracer.error(`Error starting server: ${error.message}`);
134+
this._serverStarting = false;
135+
this._serverStarted = false;
136+
this._error = error;
137+
reject(error);
138+
} else {
139+
tracer.info(`Server started and listening at http://localhost:${this._options.port}`);
140+
this._error = null;
141+
this._serverStarting = false;
142+
this._serverStarted = true;
143+
resolve(this);
144+
}
145+
});
146+
} catch (error) {
147+
reject(error);
148+
}
141149
}
142150

143151
get settings() {

0 commit comments

Comments
 (0)