A test adapter for VSCode using the Test Explorer UI extension.
- Records munit, utest, buddy, hexUnit, tink_unittest and haxe.unit test results as JSON files
- Shows latest test results in VSCode using the Test Explorer UI extension
- Supports filtering / running individual tests directly from VSCode
- Supports Haxe 3.4.7 and 4.0.0-rc.1 (detection of test function line numbers only works with Haxe 4)
- Currently only works for Node.js and sys targets
A small sample project for each supported framework can be found in the samples directory.
You can run your tests using the Test Explorer: Run all tests
command or by clicking the button in the "Test" tab of the activity bar. The command that it runs can be configured with this setting:
"haxeTestExplorer.testCommand": [
"${haxe}",
"test.hxml",
"-lib",
"test-adapter"
]
As you can see, by default it assumes the presence of a test.hxml
that compiles and runs the tests. Additionally, the test-adapter
library is injected (which is automatically installed with this extension). It adds hooks to the different testing frameworks to record the test results in a .unittest
folder in your workspace.
.unittest
should be added to your .gitignore
. You might also want to hide it from VSCode's file explorer by adding this to your global settings:
"files.exclude": {
"**/.unittest": true
}
It's also possible to debug tests using a launch configuration from launch.json
. Which one should be used can be configured with this setting:
"haxeTestExplorer.launchConfiguration": "Debug"
cd ~/.vscode/extensions
git clone https://github.com/vshaxe/haxe-test-adapter
cd haxe-test-adapter
npm install
haxe build.hxml