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/"
}
}
},
"tests": {
"Non-trailing-slash base URL (exact match)": {
"expectedResults": {
}
},
"Trailing-slash base URL (fail)": {
"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/"
}
}
},
"tests": {
"Non-trailing-slash base URL (fail)": {
"expectedResults": {
"moment": null,
"moment/foo": null
}
},
"Trailing-slash base URL (exact match)": {
"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/"
}
}
},
"tests": {
"Non-trailing-slash base URL (exact match)": {
"expectedResults": {
}
},
"Trailing-slash base URL (exact match)": {
"expectedResults": {
}
},
"Subpath base URL (prefix match)": {
"expectedResults": {
}
},
"Non-subpath base URL (fail)": {
"expectedResults": {
"moment": null,
"moment/foo": null
}
}
}
}
}
}