While working on the linear memory inspector component
(https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2501301)
we discovered that both snippets and quick_open were side-effect
instantiating instances during module loading. This caused issues
when trying to write isolated unittests for other components, if
they were (transitively) importing these modules.
To resolve these issues, we defer creation to the appropriate time.
In the case of CommandMenu, this was a small refactoring to use
the instance-singleton-pattern we have been using throughout the
codebase.
For Snippets, it was less obvious. In the end, we realized that
the singleton instances that snippets/ was relying on were constructed
in `Main.MainImpl.MainImpl._createAppUI`. More specifically,
the instantiation of `self.Persistence.isolatedFileSystemManager`
right at the top of `_createAppUI` was implicitly required for
snippets/.
This wasn't a problem when loading DevTools, as we lazy-load snippets/
after we instantiate `MainImpl`. Hence, the singletons were in place
and the code would correctly function. However, that assumption is
invalid when loading `snippets/` in isolation, which was the case
when writing the unit test.
The same treatment was necessary for `Snippets.project`, which has
been moved to a lazily-computed function.
R=aerotwist@chromium.org,jacktfranklin@chromium.org,kimanh@chromium.org
Fixed: 1143170
Change-Id: I28d3bbbc428f0316ca89453f98331b7479711c87
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2503953
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
The configuration was only including files that were in a commit diff.
This causes issues where we generate sources during the PRESUBMIT (which
are not in the git diff at that point in time) and don't format.
At the same time, we remove the complicated logic to reuse the
`.eslintignore` for clang-format purposes and use the correct
`.clang-format` "DisableFormat" options to disable formatting in various
directories.
Roll CodeMirror: ignore
Change-Id: I21b95a6e09c5d6bf036bf1aace103d6c26823ecc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091445
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
This is a reland of 5d36acc6cb
Problematic timeout logic has been removed for now, pending resolution
of crbug.com/1032477
Original change's description:
> Migrate test_runner/ to ESM
>
> The TestRunner logic breaks when trying to load as an ES module. This
> was the root cause for the failures we saw when we were migrating main/
> to ESM.
>
> Since TestRunner directly relies on main/ existence, we first have to
> migrate the test_runner to ESM. However, this uncovered a lot of
> problems. Most importantly, symbols were sometimes overwritten and
> ordering was important.
>
> The bootstrap methods of TestRunner are now moved to the top. This
> includes setting up the error-catching logic and adding results.
>
> All other symbols are exported but also put on the global scope, as that
> is what the layout tests still require.
>
> A pre-existing bug is the fact that tests time out if there is any
> (syntax) issue in TestRunner itself. We will need to fix that issue, as
> it makes debugging TestRunner itself very difficult. However, I will
> punt that to a follow-up CL, as this CL is already quite difficult to
> reason about.
>
> Bug: 1006759, 1019182
> Change-Id: Id64422968171888dbdbcc927dfd174d7868f333e
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1953583
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Bug: 1006759, 1019182, 1032477
Change-Id: I26bbda9a39f28291d88fb56a2d5b68899314f212
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1958992
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>