forked from ManageIQ/manageiq-ui-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
70 lines (57 loc) · 2.16 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
64
65
66
67
68
69
70
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'English'
require 'manageiq-ui-classic'
ManageIQ::UI::Classic::Engine.load_tasks
begin
require 'rspec/core/rake_task'
APP_RAKEFILE = File.expand_path("../spec/manageiq/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
rescue LoadError
end
if defined?(RSpec) && defined?(RSpec::Core::RakeTask)
namespace :spec do
desc "Setup environment for specs"
task :setup => ["app:test:initialize", "app:test:verify_no_db_access_loading_rails_environment", "app:test:setup_db"]
end
RSpec::Core::RakeTask.new(:spec => ["app:test:initialize", "app:evm:compile_sti_loader"]) do |t|
spec_dir = File.expand_path("spec", __dir__)
EvmTestHelper.init_rspec_task(t, ['--require', File.join(spec_dir, 'spec_helper')])
t.pattern = FileList[spec_dir + '/**/*_spec.rb'].exclude(spec_dir + '/manageiq/**/*_spec.rb')
end
end
# Only load the jasmine tasks if we are within this repo, otherwise, the bundle
# won't contain the jasmine gem (i.e., from manageiq)
if ENV["BUNDLE_GEMFILE"].nil? || ENV["BUNDLE_GEMFILE"] == File.expand_path("../Gemfile", __FILE__)
require 'jasmine'
load 'jasmine/tasks/jasmine.rake'
require './config/jasmine_overrides'
# running jasmine outside ci ignores the `random: false` in `jasmine.yml` - needs a message
task :jasmine_url do
puts
puts "Please open http://localhost:#{Jasmine.config.port(:server)}/?random=false"
puts
end
Rake::Task['jasmine'].prerequisites.unshift 'jasmine_url'
end
namespace :spec do
desc "Run all javascript specs"
task :javascript => ["app:test:initialize", :environment, "jasmine:ci"]
desc "Try to compile assets"
task :compile => ["app:assets:precompile"]
desc "Run Jest tests"
task :jest do
system('yarn test')
exit $CHILD_STATUS.exitstatus
end
namespace :jest do
desc 'Run Jest tests with node debugger'
task :debug do
puts
puts "open your chrome://inspect/#devices on your chrome based browser (see https://facebook.github.io/jest/docs/en/troubleshooting.html for more details)"
puts
system('node --inspect-brk node_modules/.bin/jest --runInBand')
end
end
end
task :default => :spec