diff --git a/testing/web-platform/tests/import-maps/common/README.md b/testing/web-platform/tests/import-maps/common/README.md index cda42d06099f1..6092c0d767050 100644 --- a/testing/web-platform/tests/import-maps/common/README.md +++ b/testing/web-platform/tests/import-maps/common/README.md @@ -6,7 +6,12 @@ tests for the reference JavaScript implementation at [WICG repository](https://g ## Basics -A **test object** describes a set of parameters (import maps and base URLs) and specifiers to be tested. +A **test object** describes a set of parameters (import maps and base URLs) and test expectations. +Test expectations can be: + +- Expected resulting URLs for specifiers (resolution tests), or +- Expected parsed import maps (parsing tests). + Each JSON file under [resources/](resources/) directory consists of a test object. A minimum test object would be: @@ -33,10 +38,11 @@ Required fields: - In WPT tests, this is used for the test name of `promise_test()` together with specifier to be resolved, like `"Main test name: a"`. - `importMap` (object or string): the import map to be attached. - `importMapBaseURL` (string): the base URL used for [parsing the import map](https://wicg.github.io/import-maps/#parse-an-import-map-string). -- `baseURL` (string): the base URL used in [resolving a specifier](https://wicg.github.io/import-maps/#resolve-a-module-specifier) for each specifiers. -- `expectedResults` (object; string to (string or null)): test cases. +- (resolution tests only) `expectedResults` (object; string to (string or null)): resolution test cases. - The keys are specifiers to be resolved. - The values are expected resolved URLs. If `null`, resolution should fail. +- (resolution tests only) `baseURL` (string): the base URL used in [resolving a specifier](https://wicg.github.io/import-maps/#resolve-a-module-specifier) for each specifiers. +- (parsing tests only) `expectedParsedImportMap` (object): the expected parsed import map for parsing test cases. Optional fields: diff --git a/testing/web-platform/tests/import-maps/common/parsing.tentative.html b/testing/web-platform/tests/import-maps/common/parsing.tentative.html new file mode 100644 index 0000000000000..d3334d7bbb9b4 --- /dev/null +++ b/testing/web-platform/tests/import-maps/common/parsing.tentative.html @@ -0,0 +1,26 @@ + + + + +
+ diff --git a/testing/web-platform/tests/import-maps/common/resources/common-test-helper.js b/testing/web-platform/tests/import-maps/common/resources/common-test-helper.js index 002c4b51fd06a..0ddad9fe150b5 100644 --- a/testing/web-platform/tests/import-maps/common/resources/common-test-helper.js +++ b/testing/web-platform/tests/import-maps/common/resources/common-test-helper.js @@ -2,17 +2,15 @@ setup({allow_uncaught_exception : true}); // Creates a new Document (via