Skip to content

Fixes #2375. Add some diagnostic logging for checkServer #2385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions tests/functional/lib/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ var url = function(path, params) {
return params ? base + params : base;
};

/*
This method makes a call to our API and
/*
This method makes a call to our API and
checks that the server is returning fixture data,
it will also check if there's anything wrong with the server.
*/
Expand All @@ -20,23 +20,31 @@ intern.registerPlugin("checkServer", function() {
return new Promise(function(resolve, reject) {
var request = http.get(url("/api/issues/100"), function(response) {
response.on("data", function(data) {
var json = JSON.parse(data);
if (!json.hasOwnProperty("_fixture")) {
reject(
new Error(
`
try {
var json = JSON.parse(data);
if (!json.hasOwnProperty("_fixture")) {
console.log("Intern checkServer has failed: (json)\n\n", json);
reject(
new Error(
`
=======================================================
It seems like you didn't start the server in test mode.
Open another terminal and window type:
Open another terminal and window type:
\x1b[32m npm run start:test\x1b[0m
or
\x1b[32m python run.py -t\x1b[0m
=======================================================
`
)
)
);
} else {
resolve("All is well!");
}
} catch (e) {
console.log(e);
reject(
new Error("Intern checkServer has failed trying to parse json")
);
} else {
resolve("All is well!");
}
});
});
Expand All @@ -48,7 +56,7 @@ intern.registerPlugin("checkServer", function() {
`
======================================================
Oops, something went wrong. Try restarting the server.
Open another terminal and window type:
Open another terminal and window type:
\x1b[32m npm run start:test\x1b[0m
or
\x1b[32m python run.py -t\x1b[0m
Expand Down