|
| 1 | +@startuml "Running a test case" |
| 2 | +start |
| 3 | + |
| 4 | +:create work dir; |
| 5 | +note right |
| 6 | + It'll be different per test-case |
| 7 | + and per template basis. |
| 8 | +end note |
| 9 | +-> e2e/~__workdir_symlink__/{template}/{test-case}; |
| 10 | + |
| 11 | +if (has a node_modules dir?) then (yes) |
| 12 | + :symlink node_modules; |
| 13 | + note left |
| 14 | + avoid re-running npm install |
| 15 | + for each test case and template; |
| 16 | + end note |
| 17 | +else (no) |
| 18 | +endif |
| 19 | + |
| 20 | +:copy files from template; |
| 21 | +note right |
| 22 | + all files in template dir are |
| 23 | + copied to test case work dir |
| 24 | + except `node_modules` and |
| 25 | + `package-lock.josn` |
| 26 | +end note |
| 27 | + |
| 28 | +while (for each file in test case dir) |
| 29 | + if (is snapshot dir) then (yes) |
| 30 | + :symlink dir; |
| 31 | + note left |
| 32 | + snapshots directories are symlinked |
| 33 | + to test case source dir so that |
| 34 | + updating them would update in the |
| 35 | + source folder |
| 36 | + end note |
| 37 | + |
| 38 | + else if (is jest.config.js) then (yes) |
| 39 | + if (jest.config.js is function?) then (yes) |
| 40 | + :call with parent content; |
| 41 | + note left |
| 42 | + allows for |
| 43 | + extending |
| 44 | + end note |
| 45 | + else (no) |
| 46 | + endif |
| 47 | + |
| 48 | + else (others) |
| 49 | + :copy; |
| 50 | + note right |
| 51 | + all files in test case source |
| 52 | + dir are copied to the work dir |
| 53 | + except `node_modules` and |
| 54 | + `package-lock.josn` |
| 55 | + end note |
| 56 | + |
| 57 | + endif |
| 58 | +endwhile |
| 59 | + |
| 60 | +:create special files; |
| 61 | +note right |
| 62 | + some special files are created |
| 63 | + to handle hooks for example and |
| 64 | + grab `process()` IO for later |
| 65 | + expectations |
| 66 | +end note |
| 67 | + |
| 68 | +:update package.json; |
| 69 | +note right |
| 70 | + set a custom but fixed name |
| 71 | + and version in package.json |
| 72 | + which is specific to the |
| 73 | + test case + template |
| 74 | +end note |
| 75 | + |
| 76 | +#tomato:run tests; |
| 77 | + |
| 78 | +while (for each snapshot) is (missing in test case) |
| 79 | + :copy; |
| 80 | + note right |
| 81 | + while we symlinked each snapshots |
| 82 | + directory, newly created snapshots |
| 83 | + in non existing dir will need to |
| 84 | + be copied over into |
| 85 | + e2e/~__cases__/{test-case} |
| 86 | + end note |
| 87 | +endwhile |
| 88 | + |
| 89 | +:return results; |
| 90 | + |
| 91 | +stop |
| 92 | + |
| 93 | +@enduml |
0 commit comments