« get me outta code hell

Merge branch 'tap18' into track-data-cleanup - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/coverage-map.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-30 09:36:53 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-30 09:36:53 -0300
commit34f2bb0a4b0e18a2495892627740484f41b60165 (patch)
tree0087bc514432b62dabc16d271991e3c421d0fb01 /coverage-map.js
parent6eaa070e5c036ba8cd45f79c16dc2732b40ea480 (diff)
parentb6dad614959a64f742fe6471b622d3fcc784b725 (diff)
Merge branch 'tap18' into track-data-cleanup
Diffstat (limited to 'coverage-map.js')
-rw-r--r--coverage-map.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/coverage-map.js b/coverage-map.js
new file mode 100644
index 0000000..0ed9d60
--- /dev/null
+++ b/coverage-map.js
@@ -0,0 +1,56 @@
+// node-tap test -> src coverage map
+// https://node-tap.org/coverage/
+
+export default function map(F) {
+  let match;
+
+  // unit/content/...
+
+  match = F.match(/^test\/unit\/content\/(.*)$/);
+  if (match) {
+    const f = match[1];
+
+    match = f.match(/^dependencies\/(.*)\.js$/);
+    if (match) {
+      return `src/content/dependencies/${match[1]}.js`;
+    }
+  }
+
+  // unit/data/...
+
+  match = F.match(/^test\/unit\/data\/(.*)$/);
+  if (match) {
+    const f = match[1];
+
+    match = f.match(/^things\/(.*)\.js$/);
+    if (match) {
+      return `src/data/things/${match[1]}.js`;
+    }
+  }
+
+  // unit/util/...
+
+  match = F.match(/^test\/unit\/util\/(.*)$/);
+  if (match) {
+    const f = match[1];
+
+    switch (f) {
+      case 'html.js':
+        return 'src/util/html.js';
+    }
+  }
+
+  // snapshot/...
+
+  match = F.match(/^test\/snapshot\/(.*)$/);
+  if (match) {
+    const f = match[1];
+
+    match = f.match(/^(.*)\.js$/);
+    if (match) {
+      return `src/content/dependencies/${match[1]}.js`;
+    }
+  }
+
+  return null;
+}