Files
Danny Tuppeny 5d2d5cb8ba [analysis_server] Pre-compile server for integration tests
By default the integration tests spawn the server using the snapshot from the active SDK. If you forget to recompile the SDK when running the integration tests, you may get inaccurate results.

One option is to set the `TEST_SERVER_SNAPSHOT` env variable to `"false"` which will run the tests from source, however using the "Run All Tests" command in VS Code will result in a lot of timeouts because tests run concurrently and each one will cause a compilation.

This change instead creates a new VS Code task that will compile the server to a temporary file in `.dart_tool`, and creates a launch configuration that triggers this task (via `preLaunchTask`) when running integration tests. This supports both running all tests (with the "Run All Tests" command) or running individual integration test files, with just a single up-front compilation.

Change-Id: I0970ffb76240abd54ff2c8a9c9be4bab40693691
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2025-06-26 13:35:13 -07:00

34 lines
1.2 KiB
JSON

{
"version": "0.2.0",
"configurations": [
{
"name": "Current file",
"request": "launch",
"type": "dart",
"program": "${file}",
},
{
"name": "test: all",
"request": "launch",
"type": "dart",
"program": "test/test_all.dart",
},
{
"name": "Dart - Integration Tests",
"type": "dart",
"request": "launch",
// By specifying "templateFor", this config acts as a template when launching things inside the "integration_test" folder
// from the CodeLens links and from the VS Code test runner.
"templateFor": "integration_test",
// Run the task to pre-compile the analysis server into the .dart_tool folder.
"preLaunchTask": "dart: compile analysis server",
// Pass the path of that snapshot in the `TEST_SERVER_SNAPSHOT` env variable so
// that the integration tests will use this instead of the one in the current
// SDK.
"env": {
"TEST_SERVER_SNAPSHOT": ".dart_tool/integration_tests_analysis_server.dart.snapshot"
},
}
]
}