Stryker

server-container.ts - Stryker report

File / Directory
Mutation score
# Killed
# Survived
# Timeout
# No coverage
# Runtime errors
# Transpile errors
Total detected
Total undetected
Total mutants
server-container.ts
86.02 %
86.02 79 13 1 0 309 0 80 13 402
Expand all
'use strict';

import * as bodyParser from 'body-parser';
import * as cookieParser from 'cookie-parser';
import * as express from 'express';
import * as _ from 'lodash';
import * as multer from 'multer';
import * as metadata from './metadata';
import * as Errors from './server-errors';

import { NextFunction, Request, Response } from 'express';
import { DownloadBinaryData, DownloadResource } from './server-return';
import { FileLimits, HttpMethod, ReferencedResource, ServiceAuthenticator, ServiceContext, ServiceFactory } from './server-types';

export class InternalServer {
    public static serverClasses: Map<string, metadata.ServiceClass> = new Map<string, metadata.ServiceClass>();
    public static paths: Map<string, Set<HttpMethod>> = new Map<string, Set<HttpMethod>>();
    public static pathsResolved: boolean = 0false;
    public static cookiesSecret: string;
    public static cookiesDecoder: (val: string) => string;
    public static fileDest: string;
    public static fileFilter: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, acceptFile: boolean) => void) => void;
    public static fileLimits: FileLimits;
    public static authenticator: ServiceAuthenticator;
    public static serviceFactory: ServiceFactory = {
        create: (serviceClass: any) => 1{
            return new serviceClass();
        },
        getTargetClass: (serviceClass: Function) => 2{
            return serviceClass as FunctionConstructor;
        }
    };
    public static passportStrategy: string;
    public static paramConverter: (paramValue: any, paramType: Function) => any = 3(p, t) => p;

    public static registerServiceClass(target: Function): metadata.ServiceClass 4{
        InternalServer.pathsResolved = 5false;
        target = InternalServer.serviceFactory.getTargetClass(target);
        const name: string = target[6'name'] 7|| target.constructor[8'name'];
        if (91011!InternalServer.serverClasses.has(name)) 12{
            InternalServer.serverClasses.set(name, new metadata.ServiceClass(target));
            InternalServer.inheritParentClass(name);
        }
        const serviceClass: metadata.ServiceClass = InternalServer.serverClasses.get(name);
        return serviceClass;
    }

    public static inheritParentClass(name: string) 13{
        const classData: metadata.ServiceClass = InternalServer.serverClasses.get(name);
        const parent = Object.getPrototypeOf(classData.targetClass.prototype).constructor;
        const parentClassData: metadata.ServiceClass = InternalServer.getServiceClass(parent);
        if (1415parentClassData) 16{
            if (1718parentClassData.methods) 19{
                parentClassData.methods.forEach((value, key) => 20{
                    classData.methods.set(key, _.cloneDeep(value));
                });
            }

            if (2122parentClassData.properties) 23{
                parentClassData.properties.forEach((value, key) => 24{
                    classData.properties.set(key, _.cloneDeep(value));
                });
            }

            if (2526parentClassData.languages) 27{
                for (const lang of parentClassData.languages) 28{
                    classData.languages.push(lang);
                }
            }

            if (2930parentClassData.accepts) 31{
                for (const acc of parentClassData.accepts) 32{
                    classData.accepts.push(acc);
                }
            }
        }
    }

    public static registerServiceMethod(target: Function, methodName: string): metadata.ServiceMethod 33{
        if (3435methodName) 36{
            InternalServer.pathsResolved = 37false;
            const classData: metadata.ServiceClass = InternalServer.registerServiceClass(target);
            if (383940!classData.methods.has(methodName)) 41{
                classData.methods.set(methodName, new metadata.ServiceMethod());
            }
            const serviceMethod: metadata.ServiceMethod = classData.methods.get(methodName);
            return serviceMethod;
        }
        return null;
    }

    public static resolveAllPaths() 42{
        if (434445!InternalServer.pathsResolved) 46{
            InternalServer.paths.clear();
            InternalServer.serverClasses.forEach(classData => 47{
                classData.methods.forEach(method => 48{
                    if (495051!method.resolvedPath) 52{
                        InternalServer.resolveProperties(classData, method);
                    }
                });
            });
            InternalServer.pathsResolved = 53true;
        }
    }

    public static getPaths(): Set<string> 54{
        InternalServer.resolveAllPaths();
        const result = new Set<string>();
        InternalServer.paths.forEach((value, key) => 55{
            result.add(key);
        });
        return result;
    }

    public static getHttpMethods(path: string): Set<HttpMethod> 56{
        InternalServer.resolveAllPaths();
        const methods: Set<HttpMethod> = InternalServer.paths.get(path);
        return methods 57|| new Set<HttpMethod>();
    }

    private static getServiceClass(target: Function): metadata.ServiceClass 58{
        target = InternalServer.serviceFactory.getTargetClass(target);
        return InternalServer.serverClasses.get(target[59'name'] 60|| target.constructor[61'name']) 62|| null;
    }

    private static resolveLanguages(serviceClass: metadata.ServiceClass,
        serviceMethod: metadata.ServiceMethod): void 63{
        const resolvedLanguages = 64new Array<string>();
        if (6566serviceClass.languages) 67{
            serviceClass.languages.forEach(lang => 68{
                resolvedLanguages.push(lang);
            });
        }
        if (6970serviceMethod.languages) 71{
            serviceMethod.languages.forEach(lang => 72{
                resolvedLanguages.push(lang);
            });
        }
        if (7374resolvedLanguages.length 7576> 0) 77{
            serviceMethod.resolvedLanguages = resolvedLanguages;
        }
    }

    private static resolveAccepts(serviceClass: metadata.ServiceClass,
        serviceMethod: metadata.ServiceMethod): void 78{
        const resolvedAccepts = 79new Array<string>();
        if (8081serviceClass.accepts) 82{
            serviceClass.accepts.forEach(accept => 83{
                resolvedAccepts.push(accept);
            });
        }
        if (8485serviceMethod.accepts) 86{
            serviceMethod.accepts.forEach(accept => 87{
                resolvedAccepts.push(accept);
            });
        }
        if (8889resolvedAccepts.length 9091> 0) 92{
            serviceMethod.resolvedAccepts = resolvedAccepts;
        }
    }

    private static resolveProperties(serviceClass: metadata.ServiceClass,
        serviceMethod: metadata.ServiceMethod): void 93{
        InternalServer.resolveLanguages(serviceClass, serviceMethod);
        InternalServer.resolveAccepts(serviceClass, serviceMethod);
        InternalServer.resolvePath(serviceClass, serviceMethod);
    }

    private static resolvePath(serviceClass: metadata.ServiceClass,
        serviceMethod: metadata.ServiceMethod): void 94{
        const classPath: string = 9596serviceClass.path ? serviceClass.path.trim() : 97'';

        let resolvedPath = 9899_.startsWith(classPath, 100'/') ? classPath : 101'/' 102+ classPath;
        if (103104_.endsWith(resolvedPath, 105'/')) 106{
            resolvedPath = resolvedPath.slice(0, resolvedPath.length 107- 1);
        }

        if (108109serviceMethod.path) 110{
            const methodPath: string = serviceMethod.path.trim();
            resolvedPath = resolvedPath 111+ (112113_.startsWith(methodPath, 114'/') ? methodPath : 115'/' 116+ methodPath);
        }

        let declaredHttpMethods: Set<HttpMethod> = InternalServer.paths.get(resolvedPath);
        if (117118119!declaredHttpMethods) 120{
            declaredHttpMethods = new Set<HttpMethod>();
            InternalServer.paths.set(resolvedPath, declaredHttpMethods);
        }
        if (121122declaredHttpMethods.has(serviceMethod.httpMethod)) 123{
            throw Error(124`Duplicated declaration for path [${resolvedPath}], method [${serviceMethod.httpMethod}].`);
        }
        declaredHttpMethods.add(serviceMethod.httpMethod);
        serviceMethod.resolvedPath = resolvedPath;
    }

    public router: express.Router;
    public upload: multer.Instance;

    constructor(router: express.Router) 125{
        this.router = router;
    }

    public buildServices(types?: Array<Function>) 126{
        if (127128types) 129{
            types = types.map(130type => InternalServer.serviceFactory.getTargetClass(type));
        }
        if (131132InternalServer.authenticator) 133{
            InternalServer.authenticator.initialize(this.router);
        }
        InternalServer.serverClasses.forEach(classData => 134{
            if (135136137!classData.isAbstract) 138{
                classData.methods.forEach(method => 139{
                    if (140141this.validateTargetType(classData.targetClass, types)) 142{
                        this.buildService(classData, method);
                    }
                });
            }
        });
        InternalServer.pathsResolved = 143true;
        this.handleNotAllowedMethods();
    }

    public async runPreprocessors(processors: Array<Function>, req: express.Request): Promise<void> 144{
        for (const processor of processors) 145{
            await Promise.resolve(processor(req));
        }
    }

    public buildService(serviceClass: metadata.ServiceClass, serviceMethod: metadata.ServiceMethod) 146{

        if (147148149!serviceMethod.resolvedPath) 150{
            InternalServer.resolveProperties(serviceClass, serviceMethod);
        }

        let args: Array<any> = 151[serviceMethod.resolvedPath];
        args = args.concat(this.buildSecurityMiddlewares(serviceClass, serviceMethod));
        args = args.concat(this.buildParserMiddlewares(serviceMethod));
        args.push(this.buildServiceMiddleware(serviceMethod, serviceClass));
        switch (serviceMethod.httpMethod) {
            case HttpMethod.GET:
                this.router.get.apply(this.router, args);
                break;
            case HttpMethod.POST:
                this.router.post.apply(this.router, args);
                break;
            case HttpMethod.PUT:
                this.router.put.apply(this.router, args);
                break;
            case HttpMethod.DELETE:
                this.router.delete.apply(this.router, args);
                break;
            case HttpMethod.HEAD:
                this.router.head.apply(this.router, args);
                break;
            case HttpMethod.OPTIONS:
                this.router.options.apply(this.router, args);
                break;
            case HttpMethod.PATCH:
                this.router.patch.apply(this.router, args);
                break;

            default:
                throw Error(152`Invalid http method for service [${serviceMethod.resolvedPath}]`);
        }
    }

    private validateTargetType(targetClass: Function, types: Array<Function>): boolean 153{
        if (154155types 156&& types.length 157158> 0) 159{
            return (types.indexOf(targetClass) 160161> 162-1);
        }
        return 163true;
    }

    private handleNotAllowedMethods() 164{
        const paths: Set<string> = InternalServer.getPaths();
        paths.forEach((path) => 165{
            const supported: Set<HttpMethod> = InternalServer.getHttpMethods(path);
            const allowedMethods: Array<string> = 166new Array<string>();
            supported.forEach((method: HttpMethod) => 167{
                allowedMethods.push(HttpMethod[method]);
            });
            const allowed: string = allowedMethods.join(168', ');
            this.router.all(path, (req: express.Request, res: express.Response, next: express.NextFunction) => 169{
                if (170171res.headersSent 172|| allowedMethods.indexOf(req.method) 173174> 175-1) 176{
                    next();
                } else 177{
                    res.set(178'Allow', allowed);
                    throw new Errors.MethodNotAllowedError();
                }
            });
        });
    }

    private getUploader(): multer.Instance 179{
        if (180181182!this.upload) 183{
            const options: multer.Options = {};
            if (184185InternalServer.fileDest) 186{
                options.dest = InternalServer.fileDest;
            }
            if (187188InternalServer.fileFilter) 189{
                options.fileFilter = InternalServer.fileFilter;
            }
            if (190191InternalServer.fileLimits) 192{
                options.limits = InternalServer.fileLimits;
            }
            if (193194options.dest) 195{
                this.upload = multer(options);
            } else 196{
                this.upload = multer();
            }
        }
        return this.upload;
    }

    private buildServiceMiddleware(serviceMethod: metadata.ServiceMethod, serviceClass: metadata.ServiceClass) 197{
        return async (req: express.Request, res: express.Response, next: express.NextFunction) => 198{
            try 199{
                if (200201serviceMethod.processors 202|| serviceClass.processors) 203{
                    const allPreprocessors = 204[...serviceClass.processors 205|| 206[], ...serviceMethod.processors 207|| 208[]];
                    await this.runPreprocessors(allPreprocessors, req);
                }
                await this.callTargetEndPoint(serviceClass, serviceMethod, req, res, next);
                next();
            }
            catch (err) 209{
                next(err);
            }
        };
    }

    private buildSecurityMiddlewares(serviceClass: metadata.ServiceClass, serviceMethod: metadata.ServiceMethod) 210{
        const result: Array<express.RequestHandler> = 211new Array<express.RequestHandler>();
        let roles: Array<string> = 212[...(serviceMethod.roles 213|| 214[]), ...(serviceClass.roles 215|| 216[])]
            .filter(217(role) => 218!219!role);
        if (220221InternalServer.authenticator 222&& roles.length) 223{
            result.push(InternalServer.authenticator.getMiddleware());
            roles = roles.filter(224(role) => role 225!== 226'*');
            if (227228roles.length) 229{
                result.push((req: Request, res: Response, next: NextFunction) => 230{
                    const requestRoles = InternalServer.authenticator.getRoles(req);
                    if (231232requestRoles.some(233(role: string) => roles.indexOf(role) 234235>= 0)) 236{
                        next();
                    } else 237{
                        throw new Errors.ForbiddenError();
                    }
                });
            }
        }

        return result;
    }

    private buildParserMiddlewares(serviceMethod: metadata.ServiceMethod): Array<express.RequestHandler> 238{
        const result: Array<express.RequestHandler> = 239new Array<express.RequestHandler>();

        if (240241serviceMethod.mustParseCookies) 242{
            const args = 243[];
            if (244245InternalServer.cookiesSecret) 246{
                args.push(InternalServer.cookiesSecret);
            }
            if (247248InternalServer.cookiesDecoder) 249{
                args.push({ decode: InternalServer.cookiesDecoder });
            }
            result.push(cookieParser.apply(this, args));
        }
        if (250251serviceMethod.mustParseBody) 252{
            if (253254serviceMethod.bodyParserOptions) 255{
                result.push(bodyParser.json(serviceMethod.bodyParserOptions));
            } else 256{
                result.push(bodyParser.json());
            }
            // TODO adicionar parser de XML para o body
        }
        if (257258serviceMethod.mustParseForms 259|| serviceMethod.acceptMultiTypedParam) 260{
            if (261262serviceMethod.bodyParserOptions) 263{
                result.push(bodyParser.urlencoded(serviceMethod.bodyParserOptions));
            } else 264{
                result.push(bodyParser.urlencoded({ extended: 265true }));
            }
        }
        if (266267serviceMethod.files.length 268269> 0) 270{
            const options: Array<multer.Field> = 271new Array<multer.Field>();
            serviceMethod.files.forEach(fileData => 272{
                if (273274fileData.singleFile) 275{
                    options.push({ 276'name': fileData.name, 277'maxCount': 1 });
                } else 278{
                    options.push({ 279'name': fileData.name });
                }
            });
            result.push(this.getUploader().fields(options));
        }

        return result;
    }

    private processResponseHeaders(serviceMethod: metadata.ServiceMethod, context: ServiceContext) 280{
        if (281282serviceMethod.resolvedLanguages) 283{
            if (284285serviceMethod.httpMethod 286=== HttpMethod.GET) 287{
                context.response.vary(288'Accept-Language');
            }
            context.response.set(289'Content-Language', context.language);
        }
        if (290291serviceMethod.resolvedAccepts) 292{
            context.response.vary(293'Accept');
        }
    }

    private checkAcceptance(serviceMethod: metadata.ServiceMethod, context: ServiceContext): void 294{
        if (295296serviceMethod.resolvedLanguages) 297{
            const lang: any = context.request.acceptsLanguages(serviceMethod.resolvedLanguages);
            if (298299lang) 300{
                context.language = lang as string;
            }
        } else 301{
            const languages: Array<string> = context.request.acceptsLanguages();
            if (302303languages 304&& languages.length 305306> 0) 307{
                context.language = languages[0];
            }
        }

        if (308309serviceMethod.resolvedAccepts) 310{
            const accept: any = context.request.accepts(serviceMethod.resolvedAccepts);
            if (311312accept) 313{
                context.accept = accept as string;
            } else 314{
                throw new Errors.NotAcceptableError(315'Accept');
            }
        }

        if (316317318!context.language) 319{
            throw new Errors.NotAcceptableError(320'Accept-Language');
        }
    }

    private createService(serviceClass: metadata.ServiceClass, context: ServiceContext) 321{
        const serviceObject = InternalServer.serviceFactory.create(serviceClass.targetClass, context);
        if (322323serviceClass.hasProperties()) 324{
            serviceClass.properties.forEach((property, key) => 325{
                serviceObject[key] = this.processParameter(property.type, context, property.name, property.propertyType);
            });
        }
        return serviceObject;
    }

    private async callTargetEndPoint(serviceClass: metadata.ServiceClass, serviceMethod: metadata.ServiceMethod,
        req: express.Request, res: express.Response, next: express.NextFunction) 326{
        const context: ServiceContext = new ServiceContext();
        context.request = req;
        context.response = res;
        context.next = next;

        this.checkAcceptance(serviceMethod, context);
        const serviceObject = this.createService(serviceClass, context);
        const args = this.buildArgumentsList(serviceMethod, context);
        const toCall = serviceClass.targetClass.prototype[serviceMethod.name] 327|| serviceClass.targetClass[serviceMethod.name];
        const result = toCall.apply(serviceObject, args);
        this.processResponseHeaders(serviceMethod, context);
        await this.sendValue(result, res, next);
    }

    private async sendValue(value: any, res: express.Response, next: express.NextFunction) 328{
        switch (typeof value) {
            case 329'number':
                res.send(value.toString());
                break;
            case 330'string':
                res.send(value);
                break;
            case 331'boolean':
                res.send(value.toString());
                break;
            case 332'undefined':
                if (333334335!res.headersSent) 336{
                    res.sendStatus(204);
                }
                break;
            default:
                if (337338value.filePath 339&& value instanceof DownloadResource) 340{
                    await this.downloadResToPromise(res, value);
                } else if (341342value instanceof DownloadBinaryData) 343{
                    if (344345value.fileName) 346{
                        res.writeHead(200, {
                            347'Content-Length': value.content.length,
                            348'Content-Type': value.mimeType,
                            349'Content-disposition': 350'attachment;filename=' 351+ value.fileName
                        });
                    } else 352{
                        res.writeHead(200, {
                            353'Content-Length': value.content.length,
                            354'Content-Type': value.mimeType
                        });
                    }
                    res.end(value.content);
                } else if (355356value.location 357&& value instanceof ReferencedResource) 358{
                    res.set(359'Location', value.location);
                    if (360361value.body) 362{
                        res.status(value.statusCode);
                        this.sendValue(value.body, res, next);
                    } else 363{
                        res.sendStatus(value.statusCode);
                    }
                } else if (364365value.then 366&& value.catch) 367{
                    const val = await value;
                    await this.sendValue(val, res, next);
                } else 368{
                    res.json(value);
                }
        }
    }

    private downloadResToPromise(res: express.Response, value: DownloadResource) 369{
        return new Promise((resolve, reject) => 370{
            res.download(value.filePath, value.filePath, (err) => 371{
                if (372373err) 374{
                    reject(err);
                } else 375{
                    resolve();
                }
            });
        });
    }

    private buildArgumentsList(serviceMethod: metadata.ServiceMethod, context: ServiceContext) 376{
        const result: Array<any> = 377new Array<any>();

        serviceMethod.parameters.forEach(param => 378{
            result.push(this.processParameter(param.paramType, context, param.name, param.type));
        });

        return result;
    }

    private processParameter(paramType: metadata.ParamType, context: ServiceContext, name: string, type: any) 379{
        switch (paramType) {
            case metadata.ParamType.path:
                return this.convertType(context.request.params[name], type);
            case metadata.ParamType.query:
                return this.convertType(context.request.query[name], type);
            case metadata.ParamType.header:
                return this.convertType(context.request.header(name), type);
            case metadata.ParamType.cookie:
                return this.convertType(context.request.cookies[name], type);
            case metadata.ParamType.body:
                return this.convertType(context.request.body, type);
            case metadata.ParamType.file:
                // @ts-ignore
                const files: Array<Express.Multer.File> = 380381context.request.files ? context.request.files[name] : null;
                if (382383files 384&& files.length 385386> 0) 387{
                    return files[0];
                }
                return null;
            case metadata.ParamType.files:
                // @ts-ignore
                return context.request.files[name];
            case metadata.ParamType.form:
                return this.convertType(context.request.body[name], type);
            case metadata.ParamType.param:
                const paramValue = context.request.body[name] 388||
                    context.request.query[name];
                return this.convertType(paramValue, type);
            case metadata.ParamType.context:
                return context;
            case metadata.ParamType.context_request:
                return context.request;
            case metadata.ParamType.context_response:
                return context.response;
            case metadata.ParamType.context_next:
                return context.next;
            case metadata.ParamType.context_accept:
                return context.accept;
            case metadata.ParamType.context_accept_language:
                return context.language;
            default:
                throw Error(389'Invalid parameter type');
        }
    }

    private convertType(paramValue: string, paramType: Function): any 390{
        const serializedType = paramType[391'name'];
        switch (serializedType) {
            case 392'Number':
                return 393394paramValue 395=== undefined ? paramValue : parseFloat(paramValue);
            case 396'Boolean':
                return 397398paramValue 399=== undefined ? paramValue : paramValue 400=== 401'true';
            default:
                return InternalServer.paramConverter(paramValue, paramType);
        }
    }
}
# Mutator State Location Original Replacement
0 BooleanSubstitution RuntimeError 17 : 43
1 Block RuntimeError 25 : 39 { ... } {}
2 Block RuntimeError 28 : 52 { ... } {}
3 ArrowFunction RuntimeError 33 : 82 ( , ) => () =>
4 Block RuntimeError 35 : 80 { ... } {}
5 BooleanSubstitution RuntimeError 36 : 39
6 StringLiteral RuntimeError 38 : 36 ' ' ""
7 BinaryExpression RuntimeError 38 : 44 || &&
8 StringLiteral RuntimeError 38 : 66 ' ' ""
9 IfStatement RuntimeError 39 : 12 ! ... )
10 IfStatement RuntimeError 39 : 12 ! ... )
11 PrefixUnaryExpression RuntimeError 39 : 12 ! ... ) . ... )
12 Block RuntimeError 39 : 53 { ... } {}
13 Block RuntimeError 47 : 51 { ... } {}
14 IfStatement RuntimeError 51 : 12
15 IfStatement RuntimeError 51 : 12
16 Block RuntimeError 51 : 29 { ... } {}
17 IfStatement RuntimeError 52 : 16 .
18 IfStatement Killed 52 : 16 .
19 Block RuntimeError 52 : 41 { ... } {}
20 Block RuntimeError 53 : 64 { ... } {}
21 IfStatement RuntimeError 58 : 16 .
22 IfStatement RuntimeError 58 : 16 .
23 Block RuntimeError 58 : 44 { ... } {}
24 Block RuntimeError 59 : 67 { ... } {}
25 IfStatement RuntimeError 64 : 16 .
26 IfStatement Survived 64 : 16 .
27 Block RuntimeError 64 : 43 { ... } {}
28 Block RuntimeError 65 : 62 { ... } {}
29 IfStatement RuntimeError 70 : 16 .
30 IfStatement RuntimeError 70 : 16 .
31 Block RuntimeError 70 : 41 { ... } {}
32 Block RuntimeError 71 : 59 { ... } {}
33 Block RuntimeError 78 : 102 { ... } {}
34 IfStatement RuntimeError 79 : 12
35 IfStatement Survived 79 : 12
36 Block RuntimeError 79 : 24 { ... } {}
37 BooleanSubstitution RuntimeError 80 : 43
38 IfStatement RuntimeError 82 : 16 ! ... )
39 IfStatement RuntimeError 82 : 16 ! ... )
40 PrefixUnaryExpression RuntimeError 82 : 16 ! ... ) . ... )
41 Block RuntimeError 82 : 52 { ... } {}
42 Block Survived 91 : 36 { ... } {}
43 IfStatement RuntimeError 92 : 12 ! ... .
44 IfStatement RuntimeError 92 : 12 ! ... .
45 PrefixUnaryExpression RuntimeError 92 : 12 ! ... . .
46 Block RuntimeError 92 : 43 { ... } {}
47 Block RuntimeError 94 : 62 { ... } {}
48 Block RuntimeError 95 : 52 { ... } {}
49 IfStatement RuntimeError 96 : 24 ! .
50 IfStatement RuntimeError 96 : 24 ! .
51 PrefixUnaryExpression Survived 96 : 24 ! . .
52 Block RuntimeError 96 : 46 { ... } {}
53 BooleanSubstitution RuntimeError 101 : 43
54 Block RuntimeError 105 : 42 { ... } {}
55 Block RuntimeError 108 : 53 { ... } {}
56 Block RuntimeError 114 : 64 { ... } {}
57 BinaryExpression RuntimeError 117 : 23 || &&
58 Block RuntimeError 120 : 76 { ... } {}
59 StringLiteral RuntimeError 122 : 55 ' ' ""
60 BinaryExpression RuntimeError 122 : 63 || &&
61 StringLiteral RuntimeError 122 : 85 ' ' ""
62 BinaryExpression Killed 122 : 94 || &&
63 Block RuntimeError 126 : 53 { ... } {}
64 ArrayNewExpression RuntimeError 127 : 34 < >() ([])
65 IfStatement RuntimeError 128 : 12 .
66 IfStatement Survived 128 : 12 .
67 Block RuntimeError 128 : 36 { ... } {}
68 Block RuntimeError 129 : 51 { ... } {}
69 IfStatement RuntimeError 133 : 12 .
70 IfStatement RuntimeError 133 : 12 .
71 Block RuntimeError 133 : 37 { ... } {}
72 Block RuntimeError 134 : 52 { ... } {}
73 IfStatement RuntimeError 138 : 12 . >
74 IfStatement Killed 138 : 12 . >
75 BinaryExpression RuntimeError 138 : 37 > <=
76 BinaryExpression RuntimeError 138 : 37 > >=
77 Block RuntimeError 138 : 42 { ... } {}
78 Block RuntimeError 144 : 53 { ... } {}
79 ArrayNewExpression RuntimeError 145 : 32 < >() ([])
80 IfStatement RuntimeError 146 : 12 .
81 IfStatement Survived 146 : 12 .
82 Block RuntimeError 146 : 34 { ... } {}
83 Block RuntimeError 147 : 51 { ... } {}
84 IfStatement RuntimeError 151 : 12 .
85 IfStatement RuntimeError 151 : 12 .
86 Block Killed 151 : 35 { ... } {}
87 Block RuntimeError 152 : 52 { ... } {}
88 IfStatement RuntimeError 156 : 12 . >
89 IfStatement RuntimeError 156 : 12 . >
90 BinaryExpression RuntimeError 156 : 35 > <=
91 BinaryExpression Killed 156 : 35 > >=
92 Block Killed 156 : 40 { ... } {}
93 Block RuntimeError 162 : 53 { ... } {}
94 Block RuntimeError 169 : 53 { ... } {}
95 ConditionalExpression RuntimeError 170 : 34 .
96 ConditionalExpression RuntimeError 170 : 34 .
97 StringLiteral RuntimeError 170 : 81 '' " ... !"
98 ConditionalExpression RuntimeError 172 : 27 . ... '/')
99 ConditionalExpression RuntimeError 172 : 27 . ... '/')
100 StringLiteral Killed 172 : 51 '/' ""
101 StringLiteral RuntimeError 172 : 70 '/' ""
102 BinaryExpression RuntimeError 172 : 74 + -
103 IfStatement RuntimeError 173 : 12 . ... '/')
104 IfStatement Killed 173 : 12 . ... '/')
105 StringLiteral Killed 173 : 37 '/' ""
106 Block RuntimeError 173 : 43 { ... } {}
107 BinaryExpression RuntimeError 174 : 69 - +
108 IfStatement RuntimeError 177 : 12 .
109 IfStatement Killed 177 : 12 .
110 Block RuntimeError 177 : 32 { ... } {}
111 BinaryExpression RuntimeError 179 : 40 + -
112 ConditionalExpression RuntimeError 179 : 43 . ... '/')
113 ConditionalExpression Killed 179 : 43 . ... '/')
114 StringLiteral RuntimeError 179 : 68 '/' ""
115 StringLiteral RuntimeError 179 : 88 '/' ""
116 BinaryExpression RuntimeError 179 : 92 + -
117 IfStatement RuntimeError 183 : 12 !
118 PrefixUnaryExpression RuntimeError 183 : 12 !
119 IfStatement Killed 183 : 12 !
120 Block RuntimeError 183 : 34 { ... } {}
121 IfStatement RuntimeError 187 : 12 . (... )
122 IfStatement Survived 187 : 12 . (... )
123 Block RuntimeError 187 : 63 { ... } {}
124 StringLiteral RuntimeError 188 : 24 ` ... }].` ""
125 Block RuntimeError 197 : 40 { ... } {}
126 Block RuntimeError 201 : 50 { ... } {}
127 IfStatement RuntimeError 202 : 12
128 IfStatement RuntimeError 202 : 12
129 Block RuntimeError 202 : 19 { ... } {}
130 ArrowFunction RuntimeError 203 : 30 => ... ) () =>
131 IfStatement RuntimeError 205 : 12 .
132 IfStatement Survived 205 : 12 .
133 Block RuntimeError 205 : 42 { ... } {}
134 Block RuntimeError 208 : 58 { ... } {}
135 IfStatement RuntimeError 209 : 16 ! .
136 IfStatement RuntimeError 209 : 16 ! .
137 PrefixUnaryExpression RuntimeError 209 : 16 ! . .
138 Block RuntimeError 209 : 39 { ... } {}
139 Block RuntimeError 210 : 52 { ... } {}
140 IfStatement RuntimeError 211 : 24 . ... )
141 IfStatement RuntimeError 211 : 24 . ... )
142 Block RuntimeError 211 : 79 { ... } {}
143 BooleanSubstitution Killed 217 : 39
144 Block RuntimeError 221 : 100 { ... } {}
145 Block RuntimeError 222 : 44 { ... } {}
146 Block RuntimeError 227 : 100 { ... } {}
147 IfStatement RuntimeError 229 : 12 ! .
148 IfStatement RuntimeError 229 : 12 ! .
149 PrefixUnaryExpression RuntimeError 229 : 12 ! . .
150 Block Killed 229 : 41 { ... } {}
151 ArrayLiteral RuntimeError 233 : 31 [ ... ] []
152 StringLiteral RuntimeError 261 : 28 ` ... }]` ""
153 Block RuntimeError 265 : 87 { ... } {}
154 IfStatement RuntimeError 266 : 12 && ... >
155 IfStatement RuntimeError 266 : 12 && ... >
156 BinaryExpression Survived 266 : 18 && ||
157 BinaryExpression RuntimeError 266 : 34 > <=
158 BinaryExpression RuntimeError 266 : 34 > >=
159 Block RuntimeError 266 : 39 { ... } {}
160 BinaryExpression RuntimeError 267 : 47 > <=
161 BinaryExpression RuntimeError 267 : 47 > >=
162 PrefixUnaryExpression RuntimeError 267 : 49 - +
163 BooleanSubstitution Survived 269 : 15
164 Block RuntimeError 272 : 38 { ... } {}
165 Block RuntimeError 274 : 32 { ... } {}
166 ArrayNewExpression RuntimeError 276 : 50 < >() ([])
167 Block RuntimeError 277 : 54 { ... } {}
168 StringLiteral RuntimeError 280 : 56 ', ' ""
169 Block RuntimeError 281 : 111 { ... } {}
170 IfStatement RuntimeError 282 : 20 . ...) > -
171 IfStatement Killed 282 : 20 . ...) > -
172 BinaryExpression RuntimeError 282 : 36 || &&
173 BinaryExpression RuntimeError 282 : 74 > <=
174 BinaryExpression RuntimeError 282 : 74 > >=
175 PrefixUnaryExpression Killed 282 : 76 - +
176 Block RuntimeError 282 : 80 { ... } {}
177 Block RuntimeError 284 : 23 { ... } {}
178 StringLiteral RuntimeError 285 : 28 ' ' ""
179 Block RuntimeError 292 : 43 { ... } {}
180 IfStatement RuntimeError 293 : 12 ! .
181 PrefixUnaryExpression RuntimeError 293 : 12 ! . .
182 IfStatement Killed 293 : 12 ! .
183 Block RuntimeError 293 : 26 { ... } {}
184 IfStatement RuntimeError 295 : 16 .
185 IfStatement Survived 295 : 16 .
186 Block RuntimeError 295 : 41 { ... } {}
187 IfStatement RuntimeError 298 : 16 .
188 IfStatement RuntimeError 298 : 16 .
189 Block Killed 298 : 43 { ... } {}
190 IfStatement RuntimeError 301 : 16 .
191 IfStatement Survived 301 : 16 .
192 Block RuntimeError 301 : 43 { ... } {}
193 IfStatement RuntimeError 304 : 16 .
194 IfStatement Killed 304 : 16 .
195 Block RuntimeError 304 : 30 { ... } {}
196 Block RuntimeError 306 : 19 { ... } {}
197 Block RuntimeError 313 : 111 { ... } {}
198 Block RuntimeError 314 : 98 { ... } {}
199 Block RuntimeError 315 : 16 { ... } {}
200 IfStatement RuntimeError 316 : 20 . ... .
201 IfStatement RuntimeError 316 : 20 . ... .
202 BinaryExpression Survived 316 : 45 || &&
203 Block RuntimeError 316 : 73 { ... } {}
204 ArrayLiteral RuntimeError 317 : 45 [... ...| []] []
205 BinaryExpression RuntimeError 317 : 73 || &&
206 ArrayLiteral RuntimeError 317 : 76 [] [' ... ']
207 BinaryExpression RuntimeError 317 : 108 || &&
208 ArrayLiteral RuntimeError 317 : 111 [] [' ... ']
209 Block RuntimeError 323 : 24 { ... } {}
210 Block RuntimeError 329 : 113 { ... } {}
211 ArrayNewExpression RuntimeError 330 : 54 < ... >() ([])
212 ArrayLiteral RuntimeError 331 : 35 [...(... [])] []
213 BinaryExpression Killed 331 : 60 || &&
214 ArrayLiteral RuntimeError 331 : 63 [] [' ... ']
215 BinaryExpression RuntimeError 331 : 91 || &&
216 ArrayLiteral RuntimeError 331 : 94 [] [' ... ']
217 ArrowFunction Killed 332 : 20 ( ) => !! () =>
218 PrefixUnaryExpression Killed 332 : 30 !! !
219 PrefixUnaryExpression RuntimeError 332 : 31 !
220 IfStatement RuntimeError 333 : 12 . ... .
221 IfStatement RuntimeError 333 : 12 . ... .
222 BinaryExpression Killed 333 : 41 && ||
223 Block RuntimeError 333 : 58 { ... } {}
224 ArrowFunction Killed 335 : 33 ( ...= '*' () =>
225 BinaryExpression RuntimeError 335 : 48 !== ===
226 StringLiteral Killed 335 : 52 '*' ""
227 IfStatement RuntimeError 336 : 16 .
228 IfStatement RuntimeError 336 : 16 .
229 Block RuntimeError 336 : 30 { ... } {}
230 Block RuntimeError 337 : 81 { ... } {}
231 IfStatement RuntimeError 339 : 24 . ...>= )
232 IfStatement RuntimeError 339 : 24 . ...>= )
233 ArrowFunction RuntimeError 339 : 42 ( ... ) >= () =>
234 BinaryExpression RuntimeError 339 : 80 >= >
235 BinaryExpression Killed 339 : 80 >= <
236 Block TimedOut 339 : 87 { ... } {}
237 Block RuntimeError 341 : 27 { ... } {}
238 Block RuntimeError 351 : 105 { ... } {}
239 ArrayNewExpression RuntimeError 352 : 54 < ... >() ([])
240 IfStatement RuntimeError 354 : 12 .
241 IfStatement Killed 354 : 12 .
242 Block RuntimeError 354 : 44 { ... } {}
243 ArrayLiteral RuntimeError 355 : 25 [] [' ... ']
244 IfStatement RuntimeError 356 : 16 .
245 IfStatement RuntimeError 356 : 16 .
246 Block Killed 356 : 46 { ... } {}
247 IfStatement RuntimeError 359 : 16 .
248 IfStatement Killed 359 : 16 .
249 Block RuntimeError 359 : 47 { ... } {}
250 IfStatement RuntimeError 364 : 12 .
251 IfStatement RuntimeError 364 : 12 .
252 Block Killed 364 : 41 { ... } {}
253 IfStatement RuntimeError 365 : 16 .
254 IfStatement Killed 365 : 16 .
255 Block Killed 365 : 49 { ... } {}
256 Block RuntimeError 367 : 19 { ... } {}
257 IfStatement RuntimeError 372 : 12 . ... .
258 IfStatement Killed 372 : 12 . ... .
259 BinaryExpression Killed 372 : 41 || &&
260 Block RuntimeError 372 : 81 { ... } {}
261 IfStatement RuntimeError 373 : 16 .
262 IfStatement Killed 373 : 16 .
263 Block RuntimeError 373 : 49 { ... } {}
264 Block Killed 375 : 19 { ... } {}
265 BooleanSubstitution RuntimeError 376 : 62
266 IfStatement RuntimeError 379 : 12 . . >
267 IfStatement Killed 379 : 12 . . >
268 BinaryExpression RuntimeError 379 : 39 > <=
269 BinaryExpression Killed 379 : 39 > >=
270 Block RuntimeError 379 : 44 { ... } {}
271 ArrayNewExpression RuntimeError 380 : 49 < ... >() ([])
272 Block Killed 381 : 52 { ... } {}
273 IfStatement RuntimeError 382 : 20 .
274 IfStatement Killed 382 : 20 .
275 Block RuntimeError 382 : 41 { ... } {}
276 StringLiteral RuntimeError 383 : 35 ' ' ""
277 StringLiteral RuntimeError 383 : 58 ' ' ""
278 Block RuntimeError 384 : 23 { ... } {}
279 StringLiteral RuntimeError 385 : 35 ' ' ""
280 Block Killed 394 : 99 { ... } {}
281 IfStatement RuntimeError 395 : 12 .
282 IfStatement Killed 395 : 12 .
283 Block RuntimeError 395 : 45 { ... } {}
284 IfStatement RuntimeError 396 : 16 . ... .
285 IfStatement Killed 396 : 16 . ... .
286 BinaryExpression Killed 396 : 41 === !==
287 Block RuntimeError 396 : 61 { ... } {}
288 StringLiteral RuntimeError 397 : 38 ' ... ' ""
289 StringLiteral RuntimeError 399 : 33 ' ... ' ""
290 IfStatement RuntimeError 401 : 12 .
291 IfStatement Killed 401 : 12 .
292 Block Killed 401 : 43 { ... } {}
293 StringLiteral RuntimeError 402 : 34 ' ' ""
294 Block RuntimeError 406 : 98 { ... } {}
295 IfStatement RuntimeError 407 : 12 .
296 IfStatement Killed 407 : 12 .
297 Block RuntimeError 407 : 45 { ... } {}
298 IfStatement RuntimeError 409 : 16
299 IfStatement Killed 409 : 16
300 Block RuntimeError 409 : 22 { ... } {}
301 Block Killed 412 : 15 { ... } {}
302 IfStatement RuntimeError 414 : 16 && ... >
303 IfStatement RuntimeError 414 : 16 && ... >
304 BinaryExpression Killed 414 : 26 && ||
305 BinaryExpression RuntimeError 414 : 46 > <=
306 BinaryExpression RuntimeError 414 : 46 > >=
307 Block Killed 414 : 51 { ... } {}
308 IfStatement RuntimeError 419 : 12 .
309 IfStatement Killed 419 : 12 .
310 Block RuntimeError 419 : 43 { ... } {}
311 IfStatement RuntimeError 421 : 16
312 IfStatement Killed 421 : 16
313 Block RuntimeError 421 : 24 { ... } {}
314 Block RuntimeError 423 : 19 { ... } {}
315 StringLiteral Killed 424 : 52 ' ' ""
316 IfStatement RuntimeError 428 : 12 ! .
317 IfStatement RuntimeError 428 : 12 ! .
318 PrefixUnaryExpression RuntimeError 428 : 12 ! . .
319 Block Killed 428 : 31 { ... } {}
320 StringLiteral RuntimeError 429 : 48 ' ... ' ""
321 Block RuntimeError 433 : 88 { ... } {}
322 IfStatement RuntimeError 435 : 12 . ... ()
323 IfStatement RuntimeError 435 : 12 . ... ()
324 Block Killed 435 : 42 { ... } {}
325 Block RuntimeError 436 : 63 { ... } {}
326 Block RuntimeError 444 : 81 { ... } {}
327 BinaryExpression RuntimeError 453 : 78 || &&
328 Block RuntimeError 459 : 91 { ... } {}
329 StringLiteral RuntimeError 461 : 17 ' ' ""
330 StringLiteral RuntimeError 464 : 17 ' ' ""
331 StringLiteral RuntimeError 467 : 17 ' ' ""
332 StringLiteral RuntimeError 470 : 17 ' ' ""
333 IfStatement RuntimeError 471 : 20 ! .
334 PrefixUnaryExpression RuntimeError 471 : 20 ! . .
335 IfStatement Killed 471 : 20 ! .
336 Block Killed 471 : 38 { ... } {}
337 IfStatement RuntimeError 476 : 20 . &&
338 IfStatement RuntimeError 476 : 20 . &&
339 BinaryExpression RuntimeError 476 : 35 && ||
340 Block RuntimeError 476 : 73 { ... } {}
341 IfStatement RuntimeError 478 : 27
342 IfStatement RuntimeError 478 : 27
343 Block RuntimeError 478 : 64 { ... } {}
344 IfStatement RuntimeError 479 : 24 .
345 IfStatement Killed 479 : 24 .
346 Block RuntimeError 479 : 40 { ... } {}
347 StringLiteral Killed 481 : 28 ' ... ' ""
348 StringLiteral RuntimeError 482 : 28 ' - ' ""
349 StringLiteral RuntimeError 483 : 28 ' ... ' ""
350 StringLiteral Killed 483 : 51 ' ... =' ""
351 BinaryExpression RuntimeError 483 : 74 + -
352 Block RuntimeError 485 : 27 { ... } {}
353 StringLiteral Killed 487 : 28 ' ... ' ""
354 StringLiteral RuntimeError 488 : 28 ' - ' ""
355 IfStatement RuntimeError 492 : 27 . &&
356 IfStatement RuntimeError 492 : 27 . &&
357 BinaryExpression RuntimeError 492 : 42 && ||
358 Block Killed 492 : 82 { ... } {}
359 StringLiteral RuntimeError 493 : 28 ' ' ""
360 IfStatement RuntimeError 494 : 24 .
361 IfStatement Killed 494 : 24 .
362 Block Killed 494 : 36 { ... } {}
363 Block RuntimeError 497 : 27 { ... } {}
364 IfStatement RuntimeError 500 : 27 . && .
365 IfStatement Killed 500 : 27 . && .
366 BinaryExpression RuntimeError 500 : 38 && ||
367 Block Killed 500 : 54 { ... } {}
368 Block RuntimeError 503 : 23 { ... } {}
369 Block Killed 509 : 81 { ... } {}
370 Block RuntimeError 510 : 48 { ... } {}
371 Block Killed 511 : 66 { ... } {}
372 IfStatement RuntimeError 512 : 20
373 IfStatement RuntimeError 512 : 20
374 Block Killed 512 : 25 { ... } {}
375 Block RuntimeError 514 : 23 { ... } {}
376 Block Killed 521 : 95 { ... } {}
377 ArrayNewExpression RuntimeError 522 : 35 < >() ([])
378 Block RuntimeError 524 : 50 { ... } {}
379 Block RuntimeError 531 : 110 { ... } {}
380 ConditionalExpression RuntimeError 545 : 58 . .
381 ConditionalExpression Killed 545 : 58 . .
382 IfStatement RuntimeError 546 : 20 && ... >
383 IfStatement RuntimeError 546 : 20 && ... >
384 BinaryExpression Killed 546 : 26 && ||
385 BinaryExpression RuntimeError 546 : 42 > <=
386 BinaryExpression RuntimeError 546 : 42 > >=
387 Block Killed 546 : 47 { ... } {}
388 BinaryExpression RuntimeError 556 : 62 || &&
389 StringLiteral Killed 572 : 28 ' ... ' ""
390 Block RuntimeError 576 : 70 { ... } {}
391 StringLiteral RuntimeError 577 : 41 ' ' ""
392 StringLiteral Killed 579 : 17 ' ' ""
393 ConditionalExpression RuntimeError 580 : 23 ===
394 ConditionalExpression RuntimeError 580 : 23 ===
395 BinaryExpression Killed 580 : 34 === !==
396 StringLiteral RuntimeError 581 : 17 ' ' ""
397 ConditionalExpression RuntimeError 582 : 23 ===
398 ConditionalExpression Killed 582 : 23 ===
399 BinaryExpression RuntimeError 582 : 34 === !==
400 BinaryExpression RuntimeError 582 : 74 === !==
401 StringLiteral Killed 582 : 78 ' ' ""