@jsenv/test 3.3.20 → 3.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -519,6 +519,19 @@ const isWindowsPathnameSpecifier = (specifier) => {
519
519
  };
520
520
  const hasScheme = (specifier) => /^[a-zA-Z]+:/.test(specifier);
521
521
 
522
+ const createFilter = (patterns, url) => {
523
+ const associations = resolveAssociations(
524
+ {
525
+ yes: patterns,
526
+ },
527
+ url,
528
+ );
529
+ return (url) => {
530
+ const meta = applyAssociations({ url, associations });
531
+ return Boolean(meta.yes);
532
+ };
533
+ };
534
+
522
535
  const URL_META = {
523
536
  resolveAssociations,
524
537
  applyAssociations,
@@ -526,6 +539,7 @@ const URL_META = {
526
539
  applyPatternMatching,
527
540
  urlChildMayMatch,
528
541
  matches,
542
+ createFilter,
529
543
  };
530
544
 
531
545
  const filterV8Coverage = async (
@@ -1775,7 +1775,11 @@ const getCommonPathname = (pathname, otherPathname) => {
1775
1775
  return commonPathname;
1776
1776
  };
1777
1777
 
1778
- const urlToRelativeUrl = (url, baseUrl) => {
1778
+ const urlToRelativeUrl = (
1779
+ url,
1780
+ baseUrl,
1781
+ { preferRelativeNotation } = {},
1782
+ ) => {
1779
1783
  const urlObject = new URL(url);
1780
1784
  const baseUrlObject = new URL(baseUrl);
1781
1785
 
@@ -1819,7 +1823,7 @@ const urlToRelativeUrl = (url, baseUrl) => {
1819
1823
  }
1820
1824
 
1821
1825
  const relativeUrl = `${specificPathname}${search}${hash}`;
1822
- return relativeUrl;
1826
+ return preferRelativeNotation ? `./${relativeUrl}` : relativeUrl;
1823
1827
  };
1824
1828
 
1825
1829
  const pathnameToParentPathname = (pathname) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.3.20",
3
+ "version": "3.3.21",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,15 +38,15 @@
38
38
  "dependencies": {
39
39
  "@c88/v8-coverage": "0.1.1",
40
40
  "@jsenv/abort": "4.3.0",
41
- "@jsenv/ast": "6.2.8",
42
- "@jsenv/exception": "1.0.0",
43
- "@jsenv/filesystem": "4.9.4",
44
- "@jsenv/github-check-run": "0.1.26",
45
- "@jsenv/humanize": "1.2.5",
46
- "@jsenv/plugin-supervisor": "1.5.9",
47
- "@jsenv/sourcemap": "1.2.18",
48
- "@jsenv/url-meta": "8.4.2",
49
- "@jsenv/urls": "2.4.0",
41
+ "@jsenv/ast": "6.2.9",
42
+ "@jsenv/exception": "1.0.1",
43
+ "@jsenv/filesystem": "4.9.5",
44
+ "@jsenv/github-check-run": "0.1.27",
45
+ "@jsenv/humanize": "1.2.6",
46
+ "@jsenv/plugin-supervisor": "1.5.10",
47
+ "@jsenv/sourcemap": "1.2.19",
48
+ "@jsenv/url-meta": "8.5.0",
49
+ "@jsenv/urls": "2.4.1",
50
50
  "@jsenv/utils": "2.1.2",
51
51
  "he": "1.2.0",
52
52
  "istanbul-lib-coverage": "3.2.2",