Commit graph

157 commits

Author SHA1 Message Date
Johannes Rieken 2d97803568
add ListenerRefusalError and ListenerLeakError which get logged when listener thresholds are exceeded. (#212900)
* add `ListenerRefusalError` and `ListenerLeakError` which get logged when listener thresholds are exceeded.

The `stack` property of these errors will point towards the most frequent listener and how often it is used. If that's a high number there is a leak (same listener is added over and over again), if that's a low number there might be a conceptual flaw that an emitter is simply too prominent.

* rightfully don't use Error.captureStackTrace (v8/nodejs only)
2024-05-16 08:29:17 -07:00
Connor Peet 358a3a65d3
fix incomplete coverage reports on macos (#212639)
* eng: fix incomplete coverage reports on macos

Wait for stdout to drain before exiting

* better fix
2024-05-13 15:27:00 -07:00
Connor Peet 41f6f5ad6e
yea actually that doesn't work 2024-05-08 20:57:52 -07:00
Connor Peet 2aa1079dbb
just use v8-to-istanbul 2024-05-08 15:42:43 -07:00
Johannes Rieken 880eee6a96
print warning about reused action ids, fix view action duplication (#202000)
* print warning about reused action ids, fix view action duplication

* remove debug code

* make tests happy-ish
2024-01-08 16:27:32 +01:00
Connor Peet 0385382382
testing: more out-of-editor refinements (#201834)
- Som more tweaks to our own runner scripts to allow asking for the
  generated coverage formats.
- Add actions alongside debug/run for executing coverage profiles
- Finish with displaying function coverage stats in Coverage view,
  allow changing its sort order.

Fixes #200529
Fixes #199380
2024-01-04 21:22:46 +01:00
Connor Peet c016ce64fb
testing: misc work on test coverage (#201758)
- Allow coverage bar color thresholds to be configurable as the Java
  folks requested.
- Update some of our scripts for integration into
  the selfhost test runner.
- Initial parts of showing function coverage in the Test Coverage view.
  (Still a work in progress, more tomorrow)
2024-01-04 08:42:22 +01:00
Connor Peet b964ed995a
eng: fix waitServer not working in unit test debug (#201334)
Fixes #182341
2023-12-20 14:09:46 -08:00
Connor Peet 027aa0ff19
testing: avoid console log in unit tests (#201141)
Fixes #192468
2023-12-18 18:39:13 +01:00
Johannes Rieken a5698e8857
Joh/rainy-mollusk (#200976)
* snippet completions should also check with the completion model

this will allow to return "more" from the snippet completion item provider and rely on the completions model to do some filtering

* when debugging tests allow to use console.log

* fix https://github.com/microsoft/vscode/issues/191070
2023-12-15 16:07:56 +01:00
Johannes Rieken 3056f52f92
add failing/skipped test for https://github.com/microsoft/vscode/issues/191070 (#200125)
* fix --dev option of unit tests fyi @joaomoreno

* fix timing issue when getting line, add failing/skipped test for https://github.com/microsoft/vscode/issues/191070
2023-12-06 12:16:49 +01:00
Logan Ramos e5e9a6556e
Remove extra console.log (#199985) 2023-12-04 22:23:08 +01:00
Connor Peet 81ea8669f2
eng: support runGlob in browser unit tests (#199979)
Fixes #183507
2023-12-04 12:14:25 -08:00
Connor Peet a0b548807a
eng: add assertHeap method for memory assertions (#198334)
This adds an `assertHeap` function that can be used in tests. It
takes a heap snapshot, and asserts the state of classes in memory. This
works in Node and the Electron sandbox, but is a no-op in the browser.
Snapshots are process asynchronously and will report failures at the end
of the suite.

This method should be used sparingly (e.g. once at the end of a suite to
ensure nothing leaked before), as gathering a heap snapshot is fairly
slow, at least until V8 11.5.130 (https://v8.dev/blog/speeding-up-v8-heap-snapshots).

When used, the function will ensure the test has a minimum timeout
duration of 20s to avoid immediate failures.

It takes options containing a mapping of class names, and assertion functions
to run on the number of retained instances of that class. For example:

```ts
assertSnapshot({
	classes: {
		ShouldNeverLeak: count => assert.strictEqual(count, 0),
		SomeSingleton: count => assert(count <= 1),
	}
});
```

Closes https://github.com/microsoft/vscode/issues/191920
2023-11-15 10:41:22 -08:00
Daniel Imms 1532b5aebd
Add xterm scope to moore places 2023-11-02 06:34:09 -07:00
João Moreno a5d71aad39
Cleanup dependencies (#195026)
* move build dependencies to devDependencies

* build: bump tree-sitter

* dependencies cleanup

* remove leftover file
2023-10-09 09:34:15 +02:00
Connor Peet c6a9da71a2
eng: allow snapshot mutation messages locally (#194498)
* eng: allow snapshot mutation messages locally

Fixes https://github.com/microsoft/vscode/issues/192439
Fixes https://github.com/microsoft/vscode/issues/194493

* keep snapshot tests allowed
2023-09-29 18:36:27 +01:00
Connor Peet 31067371f2
eng: fix snapshot tests in macos webkit for real? (#193734)
Second attempt at this, which should work. Stop trying to use
exposeFunction, which seems to work poorly on macOS webkit in CI, and
just run a server with HTTP endpoints to do the "RPC."

Reuses Alex's "yaserver" module that we were already using for other
tests. Uses a secure random prefix for security in each run.
2023-09-21 22:48:21 +01:00
Connor Peet 8730f56c09
eng: add io warmup for webkit tests in ci (#193711)
Should fix the issue that @roblourens and @Yoyokrazy were hitting with snapshot tests on macOS WebKit in CI. Not pretty, but I'd rather do this than spend a bunch of time chasing down something that certainly seems to be a browser issue.
2023-09-21 11:03:20 -07:00
Benjamin Pasero 6b9583d2dc
fix (#192807)
* fix

* fix

* fix

* fix
2023-09-11 12:54:53 -07:00
Benjamin Pasero 0c5c400ea5
debt - more polish in global test reporter (#192774)
* debt - more polish in global test reporter

* cleanup

* cleanup

* fixes
2023-09-11 17:16:16 +02:00
Benjamin Pasero edd2f9f3f1
eng - fail test that logs unexpected output (#192700)
eng - fail test that logs
2023-09-11 14:35:48 +02:00
Johannes 8f4d4d4bad
workaround browser bug, fix browser test debugging 2023-09-05 11:47:13 +02:00
Alpha Romer Coma 7ef754c2f6
Fix supported markdown-lint violations in markdown files (#190750)
docs: fix supported markdownlint violations
2023-08-24 08:37:25 +00:00
Connor Peet 6a847ba6d1
eng: add support for snapshot tests (#190444)
* eng: add support for snapshot tests

This adds Jest-like support for snapshot testing.
Developers can do something like:

```js
await assertSnapshot(myComplexObject)
```

The first time this is run, the snapshot expectation file is written
to a `__snapshots__` directory beside the test file. Subsequent runs
will compare the object to the snapshot, and fail if it doesn't match.

You can see an example of this in the test for snapshots themselves!

After a successful run, any unused snapshots are cleaned up. On a failed
run, a gitignored `.actual` snapshot file is created beside the
snapshot for easy processing and inspection.

Shortly I will do some integration with the selfhost test extension to
allow developers to easily update snapshots from the vscode UI.

For #189680

cc @ulugbekna @hediet

* fix async stacktraces getting clobbered

* random fixes

* comment out leak detector, for now

* add option to snapshot file extension
2023-08-15 12:03:51 -07:00
Benjamin Pasero 424388032a
tests - increase timeout when running in CI (#182288) 2023-05-12 13:02:15 +02:00
Robo e5f61433b5
chore: update to Electron 22 (#177600)
* Revert "chore: revert to Electron 19 (#175851)"

This reverts commit 3a11b47eee.

* chore: bump electron@22.3.3

* build: use custom version for V8 sandbox

* chore: update electron@22.4.1

* chore: enable forceAllocationsToV8Sandbox for extension host

* chore: bump electron@22.4.2

* chore: bump electron@22.4.3

* sandbox - cleanup from electron 22 update (#178919)

* Revert "chore: revert to Electron 19 (#175851)"

This reverts commit 3a11b47eee.

* chore: bump electron@22.3.3

* build: use custom version for V8 sandbox

* chore: update electron@22.4.1

* chore: enable forceAllocationsToV8Sandbox for extension host

* chore: bump electron@22.4.2

* chore: bump electron@22.4.3

* temp: update distro

* sandbox - cleanup from electron 22 update

* missing comile

* more changes

* fix build

* restore

* 💄

* compile

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
2023-04-03 09:09:31 +02:00
Benjamin Pasero b0b69338e8
debt - further reduce electron-browser layer (#178504)
* debt - move more tests out of `electron-browser`

* move more tests

* move preload script as well

* fix
2023-03-28 10:35:58 -07:00
Rob Lourens be54d2be91
Check notebook URIs in BulkCellEdits (#169669)
* Revert "Disallow cell URIs with NotebookEdit"

This reverts commit d7576eea81.

* Check notebook URIs in BulkCellEdits
Fix #146690
2023-01-07 17:35:25 -08:00
Alexandru Dima 06b97f6be7
Add more logging and perf markers around resolving the connection token and the socket factory (#170490)
* Add more logging and perf markers around resolving the connection token and the socket factory

* set `exposeFunction` earlier

* bla windows

* also expose function for unit tests beofre opening

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
2023-01-05 10:17:19 +01:00
Connor Peet 0899758dae
ipc: use vql for uint types (#167407)
* ipc: use vql for uint types

On the plane I was reverse-engineering ipc.ts to implement it in Rust
and see if we could have a "service mode" for the CLI that we could
interact with like any other vscode process.

In doing so, I noticed that numbers in the protocol--which are used at
least twice in the message header and ID--were encoded as JSON. I was
curious what benefits we'd get from encoding them as variable-length
integers instead.

It makes the message shorter, as expected. Encode/decode time are very,
very slightly lower. I'm not sure it's worth the extra complexity, but
I have included it here for your consideration.

* fixup tests
2022-12-02 15:54:36 -08:00
Johannes d555777b1a
simplify _VSCODE_NODE_MODULES util 2022-11-18 09:42:32 +01:00
Johannes 824c70b275
fix node tests 2022-11-18 09:42:15 +01:00
Johannes 8dd8d214d8
don't use __$__nodeRequire to fetch product configuration 2022-11-18 09:41:51 +01:00
Johannes 2d6ad4be88
* add global for node_modules access
* remove most usages of require.__$__nodeRequire
* stop using require.nodeRequire
2022-11-18 09:41:43 +01:00
Raymond Zhao 9feaed8f51
Revert "joh/representative canidae" (#166641) 2022-11-17 13:53:17 -08:00
Johannes 6dd2726c73
simplify _VSCODE_NODE_MODULES util 2022-11-17 17:58:51 +01:00
Johannes 1a0223da3f
fix node tests 2022-11-17 17:19:29 +01:00
Johannes 93c3f3202b
don't use __$__nodeRequire to fetch product configuration 2022-11-17 15:41:23 +01:00
Johannes 0824db3bad
* add global for node_modules access
* remove most usages of require.__$__nodeRequire
* stop using require.nodeRequire
2022-11-17 12:09:14 +01:00
Johannes 15b8f56574
fix rendering/UI for ./scripts/test.sh --dev 2022-10-04 14:51:58 +02:00
Alexandru Dima a68f9da5fe
There is no need to pass in nodeMain when passing in baseUrl (#160893) 2022-09-14 13:04:14 +02:00
Johannes Rieken 1857d6c076
for test runinng, use --dev instead of --debug (#159040)
fixes https://github.com/microsoft/vscode/issues/159011
2022-08-24 07:54:39 -04:00
Connor Peet 39e77d74ca
fix: parse errors in coverage command (#156837)
Fixes #155615
2022-08-05 18:27:40 +02:00
Benjamin Pasero 0a7226e9ad
Revert "Increase timeout of web unit tests" (#157065)
Revert "Increase timeout of web unit tests (#156894)"

This reverts commit f86beb18e8.
2022-08-04 11:52:56 +02:00
Benjamin Pasero f86beb18e8
Increase timeout of web unit tests (#156894)
* Windows: some Firefox web tests are timing out randomly (#155760)

See if this is a fundamental issue or really Firefox is slower.

* mention issue
2022-08-03 06:55:58 +02:00
Benjamin Pasero 86e7410278
unit tests - help diagnose test failure reason for web tests (#155967) 2022-07-22 18:50:34 +02:00
Alexandru Dima 3530e85ba8
Properly return a non 0 exit code in case a test times out and fix tests which used to time out (#152329) 2022-06-16 13:02:37 +00:00
deepak1556 c3077080ec Merge remote-tracking branch 'origin' into electron-18.x.y 2022-06-10 18:29:22 +09:00
Johannes 0656d21d11
auto-fixed prefer-const violation 2022-06-08 17:49:21 +02:00