Files
Simon Zünd b59c4a7447 [test] Add import-map for web tests
This CL adds an import-map to the entry point of web tests
(i.e. integration_test_runner.html).

This allows web tests to import DevTools ES modules without knowing
the exact location of where DevTools itself is hosted or where
the test is hosted.

The CL adds a general "devtools/" route that points to the front_end
directory and can be used e.g. as:

```
import * as Common from 'devtools/core/common/common.js';
```

The CL also adds shortcuts for the test runners. These directly
replace the existing "TestRunner.loadTestModule" calls, e.g.:

```
import {TestRunner} from 'test_runner';
import {BindingsTestRunner} from 'bindings_test_runner';
```

The test runner shortcuts are not strictly necessary but we add them
for convenience.

The CL also exports the various test runners. Currently this only
exports the various *TestRunner objects that we put on the global.
Once all web tests are updated to import test runner via side-effect
free import, we can remove the TestRunners from the global object
without having to modify the tests any further.

R=dsv@chromium.org

Bug: None
Change-Id: I5d645b8178fcabc121e2e5918dc4a91850f37b7d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4458933
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2023-05-09 08:23:55 +00:00

41 lines
2.6 KiB
HTML

<!--
* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- <meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://chrome-devtools-frontend.appspot.com"> -->
<script type="importmap">
{
"imports": {
"test_runner": "./legacy_test_runner/test_runner/test_runner.js",
"accessibility_test_runner": "./legacy_test_runner/accessibility_test_runner/accessibility_test_runner.js",
"application_test_runner": "./legacy_test_runner/application_test_runner/application_test_runner.js",
"axe_core_test_runner": "./legacy_test_runner/axe_core_test_runner/axe_core_test_runner.js",
"bindings_test_runner": "./legacy_test_runner/bindings_test_runner/bindings_test_runner.js",
"console_test_runner": "./legacy_test_runner/console_test_runner/console_test_runner.js",
"coverage_test_runner": "./legacy_test_runner/coverage_test_runner/coverage_test_runner.js",
"cpu_profiler_test_runner": "./legacy_test_runner/cpu_profiler_test_runner/cpu_profiler_test_runner.js",
"data_grid_test_runner": "./legacy_test_runner/data_grid_test_runner/data_grid_test_runner.js",
"device_mode_test_runner": "./legacy_test_runner/device_mode_test_runner/device_mode_test_runner.js",
"elements_test_runner": "./legacy_test_runner/elements_test_runner/elements_test_runner.js",
"extensions_test_runner": "./legacy_test_runner/extensions_test_runner/extensions_test_runner.js",
"heap_profiler_test_runner": "./legacy_test_runner/heap_profiler_test_runner/heap_profiler_test_runner.js",
"layers_test_runner": "./legacy_test_runner/layers_test_runner/layers_test_runner.js",
"network_test_runner": "./legacy_test_runner/network_test_runner/network_test_runner.js",
"performance_test_runner": "./legacy_test_runner/performance_test_runner/performance_test_runner.js",
"sdk_test_runner": "./legacy_test_runner/sdk_test_runner/sdk_test_runner.js",
"security_test_runner": "./legacy_test_runner/security_test_runner/security_test_runner.js",
"sources_test_runner": "./legacy_test_runner/sources_test_runner/sources_test_runner.js",
"devtools/": "./"
}
}
</script>
<script type="module" src="legacy_test_runner/legacy_test_runner.js"></script>
</head>
<body id="-blink-dev-tools"></body>
</html>