From b6dad614959a64f742fe6471b622d3fcc784b725 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 30 Sep 2023 09:25:27 -0300 Subject: update to node-tap 18.4.0 --- coverage-map.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 coverage-map.js (limited to 'coverage-map.js') diff --git a/coverage-map.js b/coverage-map.js new file mode 100644 index 00000000..0ed9d60a --- /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; +} -- cgit 1.3.0-6-gf8a5 From 9b9aa750297a220d76b6602e1e23c891e50986d4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 30 Sep 2023 09:37:26 -0300 Subject: test: update coverage map for new/rearranged data unit tests --- coverage-map.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'coverage-map.js') diff --git a/coverage-map.js b/coverage-map.js index 0ed9d60a..8bbf3057 100644 --- a/coverage-map.js +++ b/coverage-map.js @@ -22,10 +22,30 @@ export default function map(F) { if (match) { const f = match[1]; + match = f.match(/^composite\/(.*?)\//); + if (match) { + switch (match[1]) { + case 'common-utilities': + return `src/data/things/composite.js`; + default: + return null; + } + } + match = f.match(/^things\/(.*)\.js$/); if (match) { return `src/data/things/${match[1]}.js`; } + + match = f.match(/^cacheable-object\.js$/); + if (match) { + return `src/data/things/cacheable-object.js`; + } + + match = f.match(/^(templateCompositeFrom|compositeFrom)\.js$/); + if (match) { + return `src/data/things/composite.js`; + } } // unit/util/... -- cgit 1.3.0-6-gf8a5 From ab7591e45e7e31b4e2c0e2f81e224672145993fa Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 1 Oct 2023 17:01:21 -0300 Subject: data, test: refactor utilities into own file Primarily for more precies test coverage mapping, but also to make navigation a bit easier and consolidate complex functions with lots of imports out of the same space as other, more simple or otherwise specialized files. --- coverage-map.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'coverage-map.js') diff --git a/coverage-map.js b/coverage-map.js index 8bbf3057..beff9e8a 100644 --- a/coverage-map.js +++ b/coverage-map.js @@ -22,14 +22,9 @@ export default function map(F) { if (match) { const f = match[1]; - match = f.match(/^composite\/(.*?)\//); + match = f.match(/^composite\/(.*)$/); if (match) { - switch (match[1]) { - case 'common-utilities': - return `src/data/things/composite.js`; - default: - return null; - } + return `src/data/composite/${match[1]}`; } match = f.match(/^things\/(.*)\.js$/); -- cgit 1.3.0-6-gf8a5