Source code

Revision control

Copy as Markdown

Other Tools

{
"name": "Exact vs. prefix based matching",
"details": "Scopes are matched with base URLs that are exactly the same or subpaths under the scopes with trailing shashes",
"tests": {
"Scope without trailing slash only": {
"importMap": {
"scopes": {
"/js": {
"moment": "/only-triggered-by-exact/moment",
"moment/": "/only-triggered-by-exact/moment/"
}
}
},
"importMapBaseURL": "https://example.com/app/index.html",
"tests": {
"Non-trailing-slash base URL (exact match)": {
"baseURL": "https://example.com/js",
"expectedResults": {
}
},
"Trailing-slash base URL (fail)": {
"baseURL": "https://example.com/js/",
"expectedResults": {
"moment": null,
"moment/foo": null
}
},
"Subpath base URL (fail)": {
"expectedResults": {
"moment": null,
"moment/foo": null
}
},
"Non-subpath base URL (fail)": {
"expectedResults": {
"moment": null,
"moment/foo": null
}
}
}
},
"Scope with trailing slash only": {
"importMap": {
"scopes": {
"/js/": {
"moment": "/triggered-by-any-subpath/moment",
"moment/": "/triggered-by-any-subpath/moment/"
}
}
},
"importMapBaseURL": "https://example.com/app/index.html",
"tests": {
"Non-trailing-slash base URL (fail)": {
"baseURL": "https://example.com/js",
"expectedResults": {
"moment": null,
"moment/foo": null
}
},
"Trailing-slash base URL (exact match)": {
"baseURL": "https://example.com/js/",
"expectedResults": {
}
},
"Subpath base URL (prefix match)": {
"expectedResults": {
}
},
"Non-subpath base URL (fail)": {
"expectedResults": {
"moment": null,
"moment/foo": null
}
}
}
},
"Scopes with and without trailing slash": {
"importMap": {
"scopes": {
"/js": {
"moment": "/only-triggered-by-exact/moment",
"moment/": "/only-triggered-by-exact/moment/"
},
"/js/": {
"moment": "/triggered-by-any-subpath/moment",
"moment/": "/triggered-by-any-subpath/moment/"
}
}
},
"importMapBaseURL": "https://example.com/app/index.html",
"tests": {
"Non-trailing-slash base URL (exact match)": {
"baseURL": "https://example.com/js",
"expectedResults": {
}
},
"Trailing-slash base URL (exact match)": {
"baseURL": "https://example.com/js/",
"expectedResults": {
}
},
"Subpath base URL (prefix match)": {
"expectedResults": {
}
},
"Non-subpath base URL (fail)": {
"expectedResults": {
"moment": null,
"moment/foo": null
}
}
}
}
}
}