Sha256: ea7cd90872964052bfc5cdc0528d4c63d203711207998ebf9a7ac9c719fd212b

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

require "rake/testtask"

namespace :test do
  desc "Run all tests"
  task all: [:fast, :system, :accessibility, :bench]

  Rake::TestTask.new(:single) do |t|
    ENV["TZ"] = "Asia/Taipei"

    t.libs << "test"
    t.libs << "lib"
    t.test_files = FileList[ENV["TESTS"]]
  end

  Rake::TestTask.new(:fast) do |t|
    ENV["TZ"] = "Asia/Taipei"

    t.libs << "test"
    t.libs << "lib"
    t.test_files = FileList[
      "test/components/**/*_test.rb",
      "test/lib/**/*_test.rb",
      "test/forms/**/*_test.rb",
      "test/primer/**/*_test.rb",
      "test/linters/**/*_test.rb",
      "test/rubocop/**/*_test.rb"
    ]
  end

  Rake::TestTask.new(:system) do |t|
    ENV["TZ"] = "Asia/Taipei"

    t.libs << "test"
    t.libs << "lib"
    t.test_files = FileList["test/system/**/*_test.rb"]
  end

  Rake::TestTask.new(:accessibility) do |t|
    ENV["TZ"] = "Asia/Taipei"

    t.libs << "test"
    t.libs << "lib"
    t.test_files = FileList["test/accessibility_test.rb"]
  end

  Rake::TestTask.new(:snapshots) do |t|
    # Clear folder
    FileUtils.rm_rf("test/snapshots")

    ENV["TZ"] = "Asia/Taipei"

    t.libs << "test"
    t.libs << "lib"
    t.test_files = FileList["test/snapshots_test.rb"]
  end

  Rake::TestTask.new(:bench) do |t|
    t.libs << "test"
    t.test_files = FileList["test/benchmarks/**/bench_*.rb"]
    t.verbose = true
  end
end

task :test do
  if ENV["TESTS"]
    Rake::Task["test:single"].invoke
  else
    Rake::Task["test:all"].invoke
  end
end

task bench: "test:bench"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
primer_view_components-0.0.102 lib/tasks/test.rake