#
Setting up a Javascript project
This guide shows you how to configure a Javascript project to run on TURBO TEST. Here's an overview of the process:
It should take around 15 minutes to install and configure your project.
#
Create configuration file
Create a .turbo_test.toml
file in your repository root if you haven't already done so. For example, execute these commands from your command line terminal:
# cd $REPOSITORY_LOCAL_DIRECTORY
touch .turbo_test.toml
#
Install Ubuntu 22.04.3 LTS packages
The default Javascript version manager is chJavascript
. Javascript installation script.
Most packages are already configured and pre-installed. TURBO TEST Ubuntu 22.04 LTS packages and services
Copy the Javascript on Rails configuration below into .turbo_test.toml
.
.turbo_test.toml
# The top level env specifies environment variables available globally.
# Environment variables are specified as key/value pairs.
[env]
RAILS_ENV=test
# A string specifying the command which executes one test file.
#
# This is where you install required programming languages, databases and other
# supporting libraries.
#
# Your repository source code is available in the /src directory.
#
# The installation is cached as a virtual machine image for subsequent test
# runs. When the install section changes, the virtual machine image is
# re-created.
#
# Installation commands are specified as a TOML multi-line string.
#
# N.B. Shell commands MUST execute non-interactively. For example, commands
# requiring user input will hang until the test run is cancelled or after a
# 15 minute timeout.
#
# You can find an overview of the configuration, packages and services available
# in the TURBO TEST Ubuntu 22.04 LTS environment here:
# http://turbo-test.com/installing_dependencies/ubuntu_2204_lts_environment
# The default ruby version mananger is chruby.
# You can find the TURBO TEST Ubuntu 22.04 LTS ruby installation script here:
# https://github.com/turbotest/ubuntu_2204_LTS/blob/main/install/ruby.sh
[base_image]
commands = '''
sudo apt update -y
# Install extra packages not already included in the base image
# sudo DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -yq \
# EXTRA_APT_PACKAGES
nvm use 20
chruby 3.3.0
bundle install
# (!) Re-build the operating system image by adding a adding a new UUID:
# clear-cache: 45f09fa5-5431-4319-8081-218fe9debf9e
'''
# (!) If you're using importmaps, you can delete node_modules / .nvm / yarn
[cache]
directories = [ "vendor/bundle", "node_modules", "/home/ubuntu/.nvm", "/home/ubuntu/.cache/yarn" ]
# The before_test_run definition specifies commands to execute before running
# your test runs.
#
# Unlike the base_image definition, before_test_run is not cached and executes
# on every test run.
#
# Use this definition to:
# - update project dependencies
# - compile classes
# - start operating system services
[before_test_run]
commands = '''
# Uncomment services needed for your project:
# sudo systemctl start elasticsearch
# sudo systemctl start memcached
# sudo systemctl start mysql
# sudo systemctl start postgresql@15-main.service
# sudo systemctl start postgresql@16-main.service
# sudo systemctl start rabbitmq
# sudo systemctl start redis
bundle install
bundle exec rails db:setup
bundle exec rails assets:precompile # May be required for UI tests
'''
# Test runs are inferred from each TOML key starting with test_run.
#
# Specify multiple test runs by adding test_run keys. For example:
# [test_run."system tests"]
# [test_run.integration]
#
# Create a default test_run if you only require one test run.
[test_run.default]
# A string specifying the command which executes one test file.
#
# The test file is passed as the last argument to the command.
command = "bundle exec rails test"
# Uncomment the line below if your project uses the Rspec testing framework.
# command = "bundle exec rspec"
# An array of file path globs which expands to a list of files. File paths are
# relative to the project directory.
#
# Each file is passed as the last argument to your test command.
# Default Rails test
files = ["test/**/*_test.rb"]
# Uncomment the line below if your project uses the Rspec testing framework.
# files = ["test/**/*_spec.rb"]
# An array of file path globs which expands to a list of files. File paths are
# relative to the project directory.
#
# No tests will be executed with any files matched in this definition section.
ignore = [
"test/models/IGNORE_test.rb"
]
# Create additional test runs when the command or files are different to the
# default test run. For example:
#
# [test_run.cucumber]
# command = "bundle exec cucumber"
# files = ["features/**/*.feature"]
Before you push your configuration to GitHub, verify your configuration locally and add required secrets from the web UI: