Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const intern = require("intern").default;
const http = require("http");
var url = function(path, params) {
var base = intern.config.siteRoot + path;
return params ? base + params : base;
};
/*
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.
*/
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) {
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:
\x1b[32m npm run start:test\x1b[0m
or
\x1b[32m python run.py -t\x1b[0m