Class: Fastlane::Actions::NpmTestAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/npm/actions/npm_test_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



24
25
26
# File 'lib/fastlane/plugin/npm/actions/npm_test_action.rb', line 24

def self.authors
  ["Erick Martins"]
end

.available_optionsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fastlane/plugin/npm/actions/npm_test_action.rb', line 37

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :script,
                       default_value: 'test',
                         description: "Test script",
                            optional: true,
                                type: String),
    
    FastlaneCore::ConfigItem.new(key: :arguments,
                        default_value: [],
                          description: "Script arguments",
                            optional: true,
                                type: Array),

    FastlaneCore::ConfigItem.new(key: :coverage,
                        default_value: false,
                          description: "With coverage",
                            optional: true,
                                type: Boolean),

    FastlaneCore::ConfigItem.new(key: :step_name,
                       default_value: "Running tests",
                         description: "Name for this step",
                            optional: true,
                                type: String),
  ]
end

.descriptionObject



20
21
22
# File 'lib/fastlane/plugin/npm/actions/npm_test_action.rb', line 20

def self.description
  "A very simple plugin to run npm scripts"
end

.detailsObject



32
33
34
35
# File 'lib/fastlane/plugin/npm/actions/npm_test_action.rb', line 32

def self.details
  # Optional:
  "A very simple plugin to run npm scripts"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
69
70
71
# File 'lib/fastlane/plugin/npm/actions/npm_test_action.rb', line 65

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



28
29
30
# File 'lib/fastlane/plugin/npm/actions/npm_test_action.rb', line 28

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fastlane/plugin/npm/actions/npm_test_action.rb', line 7

def self.run(params)
  arguments = []
  arguments = ['--coverage'] if params[:coverage]
  arguments.concat params[:arguments]

  other_action.npm_run(
    script: 'test', 
    step_name: params[:step_name],
    arguments: params[:arguments]

  )
end