lib/appmap/cucumber.rb in appmap-0.101.0 vs lib/appmap/cucumber.rb in appmap-0.102.0
- old
+ new
@@ -1,15 +1,16 @@
# frozen_string_literal: true
-require 'appmap'
-require 'appmap/util'
+require_relative '../appmap'
+require_relative './util'
+require_relative './detect_enabled'
require 'fileutils'
module AppMap
module Cucumber
APPMAP_OUTPUT_DIR = 'tmp/appmap/cucumber'
-
+
ScenarioAttributes = Struct.new(:name, :feature, :feature_group)
ProviderStruct = Struct.new(:scenario) do
def feature_group
# e.g. <Cucumber::Core::Ast::Location::Precise: cucumber/api/features/authenticate.feature:1>
@@ -41,15 +42,17 @@
end
end
class << self
def init
+ AppMap::DetectEnabled.discourage_conflicting_recording_methods :cucumber
+
warn 'Configuring AppMap recorder for Cucumber'
FileUtils.mkdir_p APPMAP_OUTPUT_DIR
end
-
+
def write_scenario(scenario, appmap)
appmap['metadata'] = update_metadata(scenario, appmap['metadata'])
scenario_filename = AppMap::Util.scenario_filename(appmap['metadata']['name'])
AppMap::Util.write_appmap(File.join(APPMAP_OUTPUT_DIR, scenario_filename), appmap)
@@ -60,10 +63,10 @@
end
def run
init
end
-
+
protected
def cucumber_version
Gem.loaded_specs['cucumber']&.version&.to_s
end