MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / wrapper

Function wrapper

services.ts:4129–4248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4127 ]);
4128 },
4129 wrapper = function node_apps_simulation_wrapper():void {
4130 node.child(`node js/services ${tests[a].command}`, {cwd: cwd, maxBuffer: 2048 * 500}, function node_apps_simulation_wrapper_child(errs:nodeError, stdout:string, stderror:string|Buffer) {
4131 if (tests[a].artifact === "" || tests[a].artifact === undefined) {
4132 writeflag = "";
4133 } else {
4134 tests[a].artifact = node.path.resolve(tests[a].artifact);
4135 writeflag = tests[a].artifact;
4136 }
4137 if (errs !== null) {
4138 if (errs.toString().indexOf("getaddrinfo ENOTFOUND") > -1) {
4139 increment("no internet connection");
4140 return;
4141 }
4142 if (errs.toString().indexOf("certificate has expired") > -1) {
4143 increment("TLS certificate expired on HTTPS request");
4144 return;
4145 }
4146 if (stdout === "") {
4147 apps.errout([errs.toString()]);
4148 return;
4149 }
4150 }
4151 if (stderror !== "") {
4152 apps.errout([stderror]);
4153 return;
4154 }
4155 if (typeof stdout === "string") {
4156 stdout = stdout.replace(/\s+$/, "").replace(/^\s+/, "").replace(/\s\d+(\.\d+)*\s/g, " XXXX ");
4157 }
4158 if (tests[a].qualifier.indexOf("file") === 0) {
4159 if (tests[a].artifact === "" || tests[a].artifact === undefined) {
4160 apps.errout([`Tests ${text.cyan + tests[a].command + text.none} uses ${text.angry + tests[a].qualifier + text.none} as a qualifier but does not mention an artifact to remove.`]);
4161 return;
4162 }
4163 if (tests[a].qualifier.indexOf("file ") === 0) {
4164 tests[a].file = node.path.resolve(tests[a].file);
4165 node.fs.readFile(tests[a].file, "utf8", function node_apps_simulation_wrapper_file(err:Error, dump:string) {
4166 if (err !== null) {
4167 apps.errout([err.toString()]);
4168 return;
4169 }
4170 if (tests[a].qualifier === "file begins" && dump.indexOf(tests[a].test) !== 0) {
4171 errout(`is not starting in file: ${text.green + tests[a].file + text.none}`, dump);
4172 return;
4173 }
4174 if (tests[a].qualifier === "file contains" && dump.indexOf(tests[a].test) < 0) {
4175 errout(`is not anywhere in file: ${text.green + tests[a].file + text.none}`, dump);
4176 return;
4177 }
4178 if (tests[a].qualifier === "file ends" && dump.indexOf(tests[a].test) === dump.length - tests[a].test.length) {
4179 errout(`is not at end of file: ${text.green + tests[a].file + text.none}`, dump);
4180 return;
4181 }
4182 if (tests[a].qualifier === "file is" && dump !== tests[a].test) {
4183 errout(`does not match the file: ${text.green + tests[a].file + text.none}`, dump);
4184 return;
4185 }
4186 if (tests[a].qualifier === "file not" && dump === tests[a].test) {

Callers 2

intervalFunction · 0.85
services.tsFile · 0.85

Calls 2

incrementFunction · 0.85
erroutFunction · 0.85

Tested by

no test coverage detected