From 3b209ba858c5a1d2cc0e20db0f504c7ce4597a9c Mon Sep 17 00:00:00 2001 From: AlexHaxe Date: Wed, 22 Jan 2025 21:19:50 +0100 Subject: [PATCH] added -D disable-attributable-coverage --- src/HaxeTestController.hx | 4 ++++ test-adapter/_testadapter/buddy/Injector.hx | 4 +++- test-adapter/_testadapter/munit/Injector.hx | 3 +++ test-adapter/_testadapter/tink_unittest/Injector.hx | 3 +++ test-adapter/_testadapter/utest/Injector.hx | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/HaxeTestController.hx b/src/HaxeTestController.hx index 0011f80..89cd210 100644 --- a/src/HaxeTestController.hx +++ b/src/HaxeTestController.hx @@ -155,6 +155,10 @@ class HaxeTestController { var haxeExecutable = vshaxe.haxeExecutable.configuration; testCommand = testCommand.map(arg -> if (arg == "${haxe}") haxeExecutable.executable else arg); + if (!isAttributableCoverageEnabled()) { + testCommand.push("-D"); + testCommand.push("disable-attributable-coverage"); + } var task = new Task({type: "haxe-test-explorer-run"}, workspaceFolder, "Running Haxe Tests with Coverage", "haxe", new ProcessExecution(testCommand.shift(), testCommand, {env: haxeExecutable.env}), cast vshaxe.problemMatchers); diff --git a/test-adapter/_testadapter/buddy/Injector.hx b/test-adapter/_testadapter/buddy/Injector.hx index c42c26a..166d87d 100644 --- a/test-adapter/_testadapter/buddy/Injector.hx +++ b/test-adapter/_testadapter/buddy/Injector.hx @@ -11,7 +11,9 @@ class Injector { public static function buildRunner():Array { var coverageEnabled:Null = Context.definedValue("instrument-coverage"); var baseFolder = haxe.io.Path.join([_testadapter.data.Data.FOLDER]); - + #if disable_attributable_coverage + coverageEnabled = null; + #end var fields = Context.getBuildFields(); for (field in fields) { switch (field.name) { diff --git a/test-adapter/_testadapter/munit/Injector.hx b/test-adapter/_testadapter/munit/Injector.hx index 7e99067..a17a61e 100644 --- a/test-adapter/_testadapter/munit/Injector.hx +++ b/test-adapter/_testadapter/munit/Injector.hx @@ -11,6 +11,9 @@ class Injector { var fields = Context.getBuildFields(); var coverageEnabled:Null = Context.definedValue("instrument-coverage"); var baseFolder = haxe.io.Path.join([_testadapter.data.Data.FOLDER]); + #if disable_attributable_coverage + coverageEnabled = null; + #end for (field in fields) { switch (field.name) { case "new": diff --git a/test-adapter/_testadapter/tink_unittest/Injector.hx b/test-adapter/_testadapter/tink_unittest/Injector.hx index dbe8031..a0cca26 100644 --- a/test-adapter/_testadapter/tink_unittest/Injector.hx +++ b/test-adapter/_testadapter/tink_unittest/Injector.hx @@ -10,6 +10,9 @@ class Injector { public static function buildRunner():Array { var fields = Context.getBuildFields(); var coverageEnabled:Null = Context.definedValue("instrument-coverage"); + #if disable_attributable_coverage + coverageEnabled = null; + #end for (field in fields) { switch (field.name) { case "run": diff --git a/test-adapter/_testadapter/utest/Injector.hx b/test-adapter/_testadapter/utest/Injector.hx index 0f4bd13..e8fa84f 100644 --- a/test-adapter/_testadapter/utest/Injector.hx +++ b/test-adapter/_testadapter/utest/Injector.hx @@ -15,6 +15,9 @@ class Injector { // skip coverage modifications when buddy is enabled coverageEnabled = null; #end + #if disable_attributable_coverage + coverageEnabled = null; + #end var baseFolder = haxe.io.Path.join([_testadapter.data.Data.FOLDER]); for (field in fields) { switch (field.name) {