diff --git a/README.md b/README.md index c9b4488..2de6619 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,52 @@ [![npm version](https://badge.fury.io/js/fastest-jest-runner.svg)](https://www.npmjs.com/package/fastest-jest-runner) -Setup: +###Motivation +From what I discovered, there are two major reasons of jest slowness, compared to jasmine e.g. +1) for every test file jest is creating new env, importing all the modules, creating jsdom env etc +2) memory leaks, which have even more effect becauase of 1) reason. + +With jest aproach: +- memory leaks could not be fixed conceptually (using vm.Context), because memory could be leaked through core modules and globals (e.g. console). +- first could not be speed up either, modules should be executed for every testfile, otherwise they will affect each other. + +This runner: +- fixes memory leaks by design: every test is run in new, forked, process, which memory being copied from main process. Process then will end and exit, not affecting and share runtime with parent process. +- while modules execution problem is not "fixed", it could be improved a lot by creating custom "snapshots", which has imported modules and created objects which then will be used by all tests. Amount of "warmed up" memory does not affect fork time. + +#####Tested only with jest 29 + +###How it works: +This runner is utilizing posix fork syscall. +Fork() is relatively cheap (~1ms), it clones (copy on write) all memory pages, file descriptors and current thread callstack of process. +Because nodejs does not support fork(), C++ extension is written and node is run in single thread mode (with some caveats with worker thread pool). + +Every test is run in new process, created by fork() call. +Communication is set up by unix sockets. +Fork is called from one of "snapshot" processes, which has warmed up env: required/imported modules, jsdom, whatever user save in global. +If `snapshotBuilderPath` is not set, default snapshot builder is applied: by default it's only init jest test env (jsdom), test runner (jasmine or circus) + +If you want best results - you will need to write custom snapshot builder. +Basically you can import all common modules, used by majority of tests. +You can even import all modules, it will only increase time of snapshot creation, not every test time. +But imported modules could not be mocked. +Last could be get arounded by marking tests with custom pragma and use empty snapshot for it (see advanced usage) + +###Scheme: + +![alt text](docs/design.png "Design") + +###Setup: 1) `yarn add fastest-jest-runner` 2) write in `jest.config`: `"runner": "fastest-jest-runner"` -Advanced usage: +###Advanced usage: [using custom snapshots](tests/e2e/snapshots/package.json) -Public - -Tested only with jest 29 - -Not working: +###Not working: - custom jest runners, except jasmine2 and circus (can be impl) - watch mode (can be impl) -- windows -- snapshots (can be impl) +- Windows OS +- jest snapshots (can be impl) +- mocking modules after require in custom snapshots +- worker threads, created in custom snapshot diff --git a/docs/design.excalidraw b/docs/design.excalidraw new file mode 100644 index 0000000..c70f98d --- /dev/null +++ b/docs/design.excalidraw @@ -0,0 +1,1213 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "id": "UTrRnPtJj5ntI5vJdRAtD", + "type": "rectangle", + "x": 474.43677031473953, + "y": 156.45051040867702, + "width": 155.70339965820312, + "height": 101.80416870117188, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 2109353500, + "version": 198, + "versionNonce": 1986577956, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "lsBhuu0hYNR291dsZ_nIf" + }, + { + "id": "l17VWMgvuYW0UFQJQorxr", + "type": "arrow" + } + ], + "updated": 1665312636202, + "link": null, + "locked": false + }, + { + "id": "lsBhuu0hYNR291dsZ_nIf", + "type": "text", + "x": 504.2884701438411, + "y": 195.35259475926296, + "width": 96, + "height": 24, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1852868252, + "version": 101, + "versionNonce": 369696284, + "isDeleted": false, + "boundElements": null, + "updated": 1665312636202, + "link": null, + "locked": false, + "text": "jest-cli", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "center", + "verticalAlign": "middle", + "baseline": 20, + "containerId": "UTrRnPtJj5ntI5vJdRAtD", + "originalText": "jest-cli" + }, + { + "id": "sKcrnF78-NDYK5pmlNj8L", + "type": "rectangle", + "x": 408.34028846858064, + "y": 337.6092283558917, + "width": 297, + "height": 154, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1395525156, + "version": 417, + "versionNonce": 975410972, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "iyTG-vQpAoOrHctyYgzsS" + }, + { + "id": "l17VWMgvuYW0UFQJQorxr", + "type": "arrow" + }, + { + "id": "lOi3fxfRMAwMOAJoIGBRS", + "type": "arrow" + }, + { + "id": "dfhxIZpfxAdYPvDpLuqY1", + "type": "arrow" + } + ], + "updated": 1665312591069, + "link": null, + "locked": false + }, + { + "id": "iyTG-vQpAoOrHctyYgzsS", + "type": "text", + "x": 415.84028846858064, + "y": 366.6092283558917, + "width": 282, + "height": 96, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1128600100, + "version": 466, + "versionNonce": 484047012, + "isDeleted": false, + "boundElements": null, + "updated": 1665312591069, + "link": null, + "locked": false, + "text": "main worker process\n(loading jest env: \nresolver, transformers, \njsdom)", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "center", + "verticalAlign": "middle", + "baseline": 92, + "containerId": "sKcrnF78-NDYK5pmlNj8L", + "originalText": "main worker process\n(loading jest env: resolver, transformers, jsdom)" + }, + { + "id": "l17VWMgvuYW0UFQJQorxr", + "type": "arrow", + "x": 552.4276716975033, + "y": 259.476389314927, + "width": 0.9188161565211885, + "height": 65.72979338666778, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 1738604060, + "version": 800, + "versionNonce": 603388572, + "isDeleted": false, + "boundElements": null, + "updated": 1665312636202, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -0.9188161565211885, + 65.72979338666778 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "UTrRnPtJj5ntI5vJdRAtD", + "gap": 1.221710205078125, + "focus": -0.011894923666685528 + }, + "endBinding": { + "elementId": "sKcrnF78-NDYK5pmlNj8L", + "gap": 12.403045654296875, + "focus": -0.04399873148601383 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "lOi3fxfRMAwMOAJoIGBRS", + "type": "arrow", + "x": 469.32344719464174, + "y": 493.6202756357393, + "width": 36.868254901719524, + "height": 75.66484200743548, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 31004828, + "version": 1011, + "versionNonce": 1269243812, + "isDeleted": false, + "boundElements": null, + "updated": 1665312591069, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -36.868254901719524, + 75.66484200743548 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "sKcrnF78-NDYK5pmlNj8L", + "gap": 2.0110472798476016, + "focus": 0.26333084843999754 + }, + "endBinding": { + "elementId": "vdNYs06ubBJ-ZyN-1EXrp", + "gap": 5.5580973963368585, + "focus": -0.19498990974672972 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "vdNYs06ubBJ-ZyN-1EXrp", + "type": "rectangle", + "x": 331.3974914618959, + "y": 574.8432150395116, + "width": 181, + "height": 130, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 767958692, + "version": 394, + "versionNonce": 1033920412, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "9FZ1r4JI6KdX69B1vhkaP" + }, + { + "id": "lOi3fxfRMAwMOAJoIGBRS", + "type": "arrow" + }, + { + "id": "4dSXPa67vwEmssNGCpQMk", + "type": "arrow" + }, + { + "id": "rI_tA4mIrxW3JQmiWRoJW", + "type": "arrow" + } + ], + "updated": 1665311969799, + "link": null, + "locked": false + }, + { + "id": "9FZ1r4JI6KdX69B1vhkaP", + "type": "text", + "x": 345.3974914618959, + "y": 579.8432150395116, + "width": 153, + "height": 120, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 18694172, + "version": 362, + "versionNonce": 1464594212, + "isDeleted": false, + "boundElements": null, + "updated": 1665311943938, + "link": null, + "locked": false, + "text": "snapshot \n\"units\"\n\nrunning user \nsetup", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "center", + "verticalAlign": "middle", + "baseline": 116, + "containerId": "vdNYs06ubBJ-ZyN-1EXrp", + "originalText": "snapshot \"units\"\n\nrunning user setup" + }, + { + "type": "rectangle", + "version": 466, + "versionNonce": 946538916, + "isDeleted": false, + "id": "kBMQONoKupNFHQpBrE9vO", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 574.0617027972194, + "y": 573.3971877061836, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 181, + "height": 130, + "seed": 222547236, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [ + { + "id": "RExGqYd0OATPQgx1LMZbW", + "type": "text" + }, + { + "id": "lOi3fxfRMAwMOAJoIGBRS", + "type": "arrow" + }, + { + "type": "text", + "id": "RExGqYd0OATPQgx1LMZbW" + }, + { + "id": "dfhxIZpfxAdYPvDpLuqY1", + "type": "arrow" + }, + { + "id": "8t15eWS7KEuE16Ww9ZJzS", + "type": "arrow" + } + ], + "updated": 1665311989425, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 439, + "versionNonce": 188695588, + "isDeleted": false, + "id": "RExGqYd0OATPQgx1LMZbW", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 588.0617027972194, + "y": 578.3971877061836, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 153, + "height": 120, + "seed": 864421660, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665311949262, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 3, + "text": "snapshot \n\"specs\"\n\nrunning user \nsetup", + "baseline": 116, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "kBMQONoKupNFHQpBrE9vO", + "originalText": "snapshot \"specs\"\n\nrunning user setup" + }, + { + "id": "dfhxIZpfxAdYPvDpLuqY1", + "type": "arrow", + "x": 584.5987581520305, + "y": 492.7307919631913, + "width": 31.149027613298472, + "height": 75.27112139157208, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 919297828, + "version": 255, + "versionNonce": 2107055260, + "isDeleted": false, + "boundElements": null, + "updated": 1665312591069, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 13.899663338773735, + 39.21792120884021 + ], + [ + 31.149027613298472, + 75.27112139157208 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "sKcrnF78-NDYK5pmlNj8L", + "gap": 1.1215636072996062, + "focus": -0.0004012168506082013 + }, + "endBinding": { + "elementId": "kBMQONoKupNFHQpBrE9vO", + "focus": -0.18017979208526666, + "gap": 5.395274351420198 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "nkbNpwZ__UcAQ5-ZNHJRX", + "type": "text", + "x": 596.4764506267759, + "y": 508.9302563611094, + "width": 143, + "height": 24, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1063463836, + "version": 121, + "versionNonce": 825251620, + "isDeleted": false, + "boundElements": null, + "updated": 1665311793404, + "link": null, + "locked": false, + "text": "posix fork()", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "left", + "verticalAlign": "top", + "baseline": 20, + "containerId": null, + "originalText": "posix fork()" + }, + { + "type": "text", + "version": 198, + "versionNonce": 1669466660, + "isDeleted": false, + "id": "AQd9pX9ccmxQp1n01_xCV", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 315.42789006323204, + "y": 516.0437835915913, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 143, + "height": 24, + "seed": 643894300, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665311788121, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 3, + "text": "posix fork()", + "baseline": 20, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "posix fork()" + }, + { + "id": "ZHsf00HfpO017bfIHWXOP", + "type": "rectangle", + "x": 90.8525930306987, + "y": 277.6770732608642, + "width": 1304.2318008017523, + "height": 692.7034063764495, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 998299804, + "version": 443, + "versionNonce": 1195606180, + "isDeleted": false, + "boundElements": null, + "updated": 1665312639020, + "link": null, + "locked": false + }, + { + "id": "fkNxnc7nPoAtdwx27qmYg", + "type": "text", + "x": 117.29184786663842, + "y": 299.1712551379527, + "width": 225, + "height": 24, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 792688540, + "version": 114, + "versionNonce": 94394396, + "isDeleted": false, + "boundElements": null, + "updated": 1665312597437, + "link": null, + "locked": false, + "text": "fastest-jest-runner", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "left", + "verticalAlign": "top", + "baseline": 20, + "containerId": null, + "originalText": "fastest-jest-runner" + }, + { + "id": "6CsmsU4iRvSvr5aoJOys0", + "type": "rectangle", + "x": 179.5044945436366, + "y": 788.3930040688145, + "width": 176, + "height": 119.19243955207742, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1532970012, + "version": 172, + "versionNonce": 833995940, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "-marmILm0rQykfMMb32-F" + }, + { + "id": "4dSXPa67vwEmssNGCpQMk", + "type": "arrow" + } + ], + "updated": 1665312021422, + "link": null, + "locked": false + }, + { + "id": "-marmILm0rQykfMMb32-F", + "type": "text", + "x": 189.8896134444712, + "y": 811.9892238448533, + "width": 154, + "height": 48, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1749268004, + "version": 117, + "versionNonce": 1089554332, + "isDeleted": false, + "boundElements": null, + "updated": 1665312021422, + "link": null, + "locked": false, + "text": "process for \ntest1.unit.ts", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "center", + "verticalAlign": "middle", + "baseline": 44, + "containerId": "6CsmsU4iRvSvr5aoJOys0", + "originalText": "process for test1.unit.ts" + }, + { + "type": "rectangle", + "version": 245, + "versionNonce": 1934189468, + "isDeleted": false, + "id": "2bETyPS4kMkVsfZMYgVVS", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 413.3627486522703, + "y": 798.9012879733735, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 176, + "height": 119.19243955207742, + "seed": 303488420, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [ + { + "id": "MQFqjuAFghGxAS0rmZ7ql", + "type": "text" + }, + { + "type": "text", + "id": "MQFqjuAFghGxAS0rmZ7ql" + }, + { + "id": "rI_tA4mIrxW3JQmiWRoJW", + "type": "arrow" + } + ], + "updated": 1665311999039, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 193, + "versionNonce": 1260729380, + "isDeleted": false, + "id": "MQFqjuAFghGxAS0rmZ7ql", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 423.7478675531049, + "y": 822.4975077494123, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 154, + "height": 48, + "seed": 1703558812, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665311999039, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 3, + "text": "process for \ntest2.unit.ts", + "baseline": 44, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "2bETyPS4kMkVsfZMYgVVS", + "originalText": "process for test2.unit.ts" + }, + { + "id": "4dSXPa67vwEmssNGCpQMk", + "type": "arrow", + "x": 372.9628317270799, + "y": 705.8432150395116, + "width": 85.94770784334503, + "height": 73.1652332248284, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 512700068, + "version": 99, + "versionNonce": 1662907420, + "isDeleted": false, + "boundElements": null, + "updated": 1665312021422, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -85.94770784334503, + 73.1652332248284 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "vdNYs06ubBJ-ZyN-1EXrp", + "focus": -0.17101911122922672, + "gap": 1 + }, + "endBinding": { + "elementId": "6CsmsU4iRvSvr5aoJOys0", + "focus": -0.38935706193952696, + "gap": 9.384555804474587 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "rI_tA4mIrxW3JQmiWRoJW", + "type": "arrow", + "x": 456.0821486127362, + "y": 709.3395399110843, + "width": 20.399286724366277, + "height": 83.85803611383278, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 17239708, + "version": 97, + "versionNonce": 540217252, + "isDeleted": false, + "boundElements": null, + "updated": 1665311999039, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 20.399286724366277, + 83.85803611383278 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "vdNYs06ubBJ-ZyN-1EXrp", + "focus": -0.1610932748366243, + "gap": 4.49632487157271 + }, + "endBinding": { + "elementId": "2bETyPS4kMkVsfZMYgVVS", + "focus": -0.08777266635103567, + "gap": 5.703711948456487 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "type": "rectangle", + "version": 268, + "versionNonce": 1842937636, + "isDeleted": false, + "id": "QgM9AZhb3lLu9L8qXFXtU", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 690.4494109678097, + "y": 788.6253757728972, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 176, + "height": 119.19243955207742, + "seed": 1438596900, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [ + { + "id": "IkfElmKhbLd9m8G_-Kp-B", + "type": "text" + }, + { + "id": "IkfElmKhbLd9m8G_-Kp-B", + "type": "text" + }, + { + "id": "rI_tA4mIrxW3JQmiWRoJW", + "type": "arrow" + }, + { + "type": "text", + "id": "IkfElmKhbLd9m8G_-Kp-B" + }, + { + "id": "8t15eWS7KEuE16Ww9ZJzS", + "type": "arrow" + } + ], + "updated": 1665311996338, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 224, + "versionNonce": 932508956, + "isDeleted": false, + "id": "IkfElmKhbLd9m8G_-Kp-B", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 700.8345298686444, + "y": 812.2215955489359, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 154, + "height": 48, + "seed": 1479718172, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665311996338, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 3, + "text": "process for \ntest1.spec.ts", + "baseline": 44, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "QgM9AZhb3lLu9L8qXFXtU", + "originalText": "process for test1.spec.ts" + }, + { + "id": "8t15eWS7KEuE16Ww9ZJzS", + "type": "arrow", + "x": 687.4083084292727, + "y": 711.1209465761422, + "width": 60.77316398138851, + "height": 72.80815259175665, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 619224476, + "version": 120, + "versionNonce": 1945104796, + "isDeleted": false, + "boundElements": null, + "updated": 1665311996338, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 60.77316398138851, + 72.80815259175665 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "kBMQONoKupNFHQpBrE9vO", + "focus": 0.26211211732641143, + "gap": 7.723758869958601 + }, + "endBinding": { + "elementId": "QgM9AZhb3lLu9L8qXFXtU", + "focus": 0.16985852294924403, + "gap": 4.696276604998445 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "type": "text", + "version": 151, + "versionNonce": 455246364, + "isDeleted": false, + "id": "V2R2vuD-sYvnBSBC-3qYW", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 655.7351120215915, + "y": 732.9435650272587, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 143, + "height": 24, + "seed": 1198144548, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665311997722, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 3, + "text": "posix fork()", + "baseline": 20, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "posix fork()" + }, + { + "type": "text", + "version": 229, + "versionNonce": 519262876, + "isDeleted": false, + "id": "yi_PvcHbGw_vwQEryj5mu", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 198.29569781081722, + "y": 713.667899370904, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 143, + "height": 24, + "seed": 678838308, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665312015022, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 3, + "text": "posix fork()", + "baseline": 20, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "posix fork()" + }, + { + "type": "text", + "version": 142, + "versionNonce": 1410239516, + "isDeleted": false, + "id": "Ijc1HMSe_7wxxILRJ2h3P", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 403.95657702602114, + "y": 733.0290639435171, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 143, + "height": 24, + "seed": 342766236, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665312004487, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 3, + "text": "posix fork()", + "baseline": 20, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "posix fork()" + }, + { + "id": "YJCMhq8BP3KHp39Sjz26O", + "type": "rectangle", + "x": 893.0493501476615, + "y": 791.0142750204225, + "width": 52.20773527972756, + "height": 123.41761441328117, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1677791388, + "version": 132, + "versionNonce": 761082532, + "isDeleted": false, + "boundElements": null, + "updated": 1665312035838, + "link": null, + "locked": false + }, + { + "type": "rectangle", + "version": 457, + "versionNonce": 383653796, + "isDeleted": false, + "id": "yvUKj87fD6FXl8IvWJbZ_", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 601.8108495899621, + "y": 792.2319888951254, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 52.20773527972756, + "height": 123.41761441328117, + "seed": 466495004, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665312050054, + "link": null, + "locked": false + }, + { + "type": "rectangle", + "version": 261, + "versionNonce": 368989988, + "isDeleted": false, + "id": "ggHBa_drImZjMu8n--XOt", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 962.2523146000935, + "y": 788.9873161123396, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 52.20773527972756, + "height": 123.41761441328117, + "seed": 473003812, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElements": [], + "updated": 1665312053720, + "link": null, + "locked": false + }, + { + "id": "q3R-qA8Fta2jFMEkE-07q", + "type": "text", + "x": 740.7590335415525, + "y": 445.8977507993692, + "width": 528, + "height": 120, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1060197796, + "version": 353, + "versionNonce": 128401308, + "isDeleted": false, + "boundElements": null, + "updated": 1665312594819, + "link": null, + "locked": false, + "text": "for each snapshotBuilder.snapshots:\n process = fork(main worker process)\n in process context:\n run user warmup code(require('mod1'))\n processPool[snapshotName] = process", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "left", + "verticalAlign": "top", + "baseline": 116, + "containerId": null, + "originalText": "for each snapshotBuilder.snapshots:\n process = fork(main worker process)\n in process context:\n run user warmup code(require('mod1'))\n processPool[snapshotName] = process" + }, + { + "id": "lI6-L6z_BLrdf0sskHlXq", + "type": "text", + "x": 800.6429211036718, + "y": 661.0949908785154, + "width": 564, + "height": 120, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 474038300, + "version": 305, + "versionNonce": 624410652, + "isDeleted": false, + "boundElements": null, + "updated": 1665312797651, + "link": null, + "locked": false, + "text": "for each test:\n snapshotName = snapshotBuilder.getSnapshot()\n process = processPool[snapshotName]\n fork(process)\n", + "fontSize": 20, + "fontFamily": 3, + "textAlign": "left", + "verticalAlign": "top", + "baseline": 116, + "containerId": null, + "originalText": "for each test:\n snapshotName = snapshotBuilder.getSnapshot()\n process = processPool[snapshotName]\n fork(process)\n" + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/docs/design.png b/docs/design.png new file mode 100644 index 0000000..b1907ad Binary files /dev/null and b/docs/design.png differ diff --git a/yarn.lock b/yarn.lock index 511e911..f85ee5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4522,7 +4522,7 @@ __metadata: "typescript@patch:typescript@^4.8.2#~builtin": version: 4.8.2 - resolution: "typescript@patch:typescript@npm%3A4.8.2#~builtin::version=4.8.2&hash=701156" + resolution: "typescript@patch:typescript@npm%3A4.8.2#~builtin::version=4.8.2&hash=a1c5e5" bin: tsc: bin/tsc tsserver: bin/tsserver