Skip to content

Commit

Permalink
Merge pull request #2488 from alphagov/migrate-to-jasmine-browser
Browse files Browse the repository at this point in the history
Migrate to jasmine browser
  • Loading branch information
chao-xian authored Jul 18, 2022
2 parents f31a27c + 8979aa0 commit d8fdf83
Show file tree
Hide file tree
Showing 11 changed files with 553 additions and 181 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
shots/*
/coverage

# Yarn
# Ignore JS dependencies
/node_modules
/yarn-error.log

# Ignore compiled assets
/public/assets
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ gem "uglifier"
group :development, :test do
gem "govuk_schemas"
gem "govuk_test"
gem "jasmine"
gem "jasmine_selenium_runner"
gem "rails_translation_manager"
gem "rubocop-govuk"
end
Expand Down
12 changes: 0 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,6 @@ GEM
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
jasmine (3.6.0)
jasmine-core (~> 3.6.0)
phantomjs
rack (>= 1.2.1)
rake
jasmine-core (3.6.0)
jasmine_selenium_runner (3.0.0)
jasmine (~> 3.0)
selenium-webdriver (~> 3.8)
json (2.6.1)
json-schema (2.8.1)
addressable (>= 2.4)
Expand Down Expand Up @@ -209,7 +200,6 @@ GEM
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
phantomjs (2.1.1.0)
plek (4.0.0)
prometheus_exporter (2.0.3)
webrick
Expand Down Expand Up @@ -390,8 +380,6 @@ DEPENDENCIES
govuk_test
htmlentities
i18n-coverage
jasmine
jasmine_selenium_runner
minitest-reporters
mocha
plek
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ require File.expand_path("config/application", __dir__)
Rails.application.load_tasks

Rake::Task[:default].clear if Rake::Task.task_defined?(:default)
task default: %i[lint test jasmine:ci]
task default: %i[lint test jasmine]
4 changes: 4 additions & 0 deletions lib/tasks/jasmine.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
desc "Run Jasmine tests"
task jasmine: :environment do
sh "yarn run jasmine:ci"
end
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"scripts": {
"lint": "yarn run lint:js && yarn run lint:scss",
"lint:js": "standardx 'app/assets/javascripts/**/*.js' 'spec/javascripts/**/*.js'",
"lint:scss": "stylelint app/assets/stylesheets/"
"lint:scss": "stylelint app/assets/stylesheets/",
"jasmine:prepare": "RAILS_ENV=test bundle exec rails assets:clobber assets:precompile",
"jasmine:ci": "yarn run jasmine:prepare && yarn run jasmine-browser-runner runSpecs",
"jasmine:browser": "yarn run jasmine:prepare && yarn run jasmine-browser-runner"
},
"standardx": {
"env": {
Expand All @@ -31,6 +34,8 @@
"extends": "stylelint-config-gds/scss"
},
"devDependencies": {
"jasmine-browser-runner": "^1.1.0",
"jasmine-core": "^4.2.0",
"standardx": "^7.0.0",
"stylelint": "^14.9.1",
"stylelint-config-gds": "^0.2.0"
Expand Down
149 changes: 0 additions & 149 deletions spec/javascripts/support/jasmine.yml

This file was deleted.

7 changes: 0 additions & 7 deletions spec/javascripts/support/jasmine_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions spec/javascripts/support/jasmine_selenium_runner.yml

This file was deleted.

22 changes: 22 additions & 0 deletions spec/support/jasmine-browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"srcDir": "public/assets/government-frontend",
"srcFiles": [
"application-*.js",
"webchat-*.js"
],
"cssFiles": [
"application-*.css"
],
"specDir": "spec/javascripts",
"specFiles": [
"**/*[sS]pec.js"
],
"helpers": [
"vendor/jquery-1.12.4.js",
"vendor/jasmine-jquery-2.0.5.js",
"vendor/jasmine-ajax-3.4.0.js",
"vendor/lolex.js",
"helpers/*.js"
],
"browser": "headlessChrome"
}
Loading

0 comments on commit d8fdf83

Please sign in to comment.