Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Use TEST_SUITE env var to drive specs
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Jan 27, 2021
1 parent 8985419 commit 01e398d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 29 deletions.
44 changes: 18 additions & 26 deletions .travis.yml
@@ -1,26 +1,18 @@
matrix:
include:
- name: "Node.js: 12"
language: node_js
cache: yarn
node_js:
- '12' # current stable
script: yarn test --runInBand
- name: "Ruby: 2.5.8"
language: ruby
cache: bundler
rvm:
- 2.5.8
addons:
postgresql: '10'
install: bin/setup
after_script: bin/ci/after_script
- name: "Ruby: 2.6.6"
language: ruby
rvm:
- 2.6.6
cache: bundler
addons:
postgresql: '10'
install: bin/setup
after_script: bin/ci/after_script
---
language: ruby
rvm:
- 2.5.8
- 2.6.6
node_js: 12
cache:
bundler: true
yarn: true
addons:
postgresql: '10'
env:
matrix:
- TEST_SUITE=spec:rails
- TEST_SUITE=spec:javascript
before_install: source bin/ci/before_install.sh
install: bin/setup
before_script: source bin/ci/before_script.sh
8 changes: 8 additions & 0 deletions bin/ci/before_install.sh
@@ -0,0 +1,8 @@
if [ "$TEST_SUITE" = "spec:javascript" ]; then
# Check if `nvm` is available as a command or bash function
type nvm
if [ $? -ne 0 ]; then . ~/.nvm/nvm.sh; fi

nvm install 12
yarn
fi
5 changes: 5 additions & 0 deletions bin/ci/before_script.sh
@@ -0,0 +1,5 @@
# not spec, and not cross repo
if [ "$TEST_SUITE" = "spec:javascript" ]; then
# make sure yarn is installed, in the right version
npm install -g yarn
fi
16 changes: 13 additions & 3 deletions lib/tasks_private/spec.rake
@@ -1,9 +1,19 @@
namespace :spec do
desc "Setup environment specs"
task :setup => ["app:test:vmdb:setup"]

RSpec::Core::RakeTask.new(:rails => :setup) do |t|
EvmTestHelper.init_rspec_task(t)
end

desc "Run javascript tests"
task :javascript => :environment do
system('yarn test --runInBand')
exit $?.exitstatus
end
end

desc "Run all specs"
RSpec::Core::RakeTask.new(:spec => 'app:test:spec_deps') do |t|
EvmTestHelper.init_rspec_task(t)
task :spec do
test_suite = ENV["TEST_SUITE"] || "spec:rails"
Rake::Task[test_suite].invoke
end

0 comments on commit 01e398d

Please sign in to comment.