Introduce Jasmine test runner

pull/2/head
Doc Ritezel 7 years ago
parent 960eb451a9
commit c79da3692c
  1. 6
      assets/.eslintrc
  2. 8
      assets/brunch-config.js
  3. 1
      assets/css/components/_container.scss
  4. 4
      assets/js/block_subscription.js
  5. 7
      assets/js/spec/base_spec.js
  6. 0
      assets/js/spec/spec_helper.js
  7. 2
      assets/js/test.js
  8. 7
      assets/package-lock.json
  9. 2
      assets/package.json
  10. 2
      circle.yml
  11. 1
      lib/explorer_web/router.ex
  12. 3
      mix.exs
  13. 1
      mix.lock
  14. 11
      test/explorer_web/features/javascript_test.exs

@ -1,3 +1,7 @@
{ {
"extends": "standard" "extends": "standard",
"plugins": ["jasmine"],
"env": {
"jasmine": true
}
} }

@ -2,7 +2,10 @@ exports.config = {
// See http://brunch.io/#documentation for docs. // See http://brunch.io/#documentation for docs.
files: { files: {
javascripts: { javascripts: {
joinTo: 'js/app.js' entryPoints: {
'js/app.js': 'js/app.js',
'js/test.js': 'js/test.js'
}
// To use a separate vendor.js bundle, specify two files path // To use a separate vendor.js bundle, specify two files path
// http://brunch.io/docs/config#-files- // http://brunch.io/docs/config#-files-
@ -63,7 +66,8 @@ exports.config = {
modules: { modules: {
autoRequire: { autoRequire: {
'js/app.js': ['js/app'] 'js/app.js': ['js/app'],
'js/test.js': ['js/test']
} }
}, },

@ -51,6 +51,7 @@
&__subsection { &__subsection {
flex: 1; flex: 1;
margin-right: explorer-size(-2); margin-right: explorer-size(-2);
& + & { margin-left: explorer-size(-2); } & + & { margin-left: explorer-size(-2); }
} }
} }

@ -0,0 +1,4 @@
class BlockSubscription {
}
export default BlockSubscription

@ -0,0 +1,7 @@
import BlockSubscription from 'js/block_subscription'
describe('BlockSubscription', function () {
it('exists', function () {
expect(BlockSubscription).toBeDefined()
})
})

@ -0,0 +1,2 @@
import './spec/spec_helper'
import './spec/base_spec'

@ -1,4 +1,5 @@
{ {
"name": "poa-explorer",
"requires": true, "requires": true,
"lockfileVersion": 1, "lockfileVersion": 1,
"dependencies": { "dependencies": {
@ -2240,6 +2241,12 @@
} }
} }
}, },
"eslint-plugin-jasmine": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jasmine/-/eslint-plugin-jasmine-2.9.1.tgz",
"integrity": "sha1-IuGaWfFvOl9kOgSroEQ40OMEcDA=",
"dev": true
},
"eslint-plugin-node": { "eslint-plugin-node": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz",

@ -13,6 +13,7 @@
"scripts": { "scripts": {
"deploy": "brunch build --production", "deploy": "brunch build --production",
"watch": "brunch watch --stdin", "watch": "brunch watch --stdin",
"build": "brunch build",
"eslint": "eslint js/**" "eslint": "eslint js/**"
}, },
"dependencies": { "dependencies": {
@ -29,6 +30,7 @@
"eslint-config-standard": "^11.0.0-beta.0", "eslint-config-standard": "^11.0.0-beta.0",
"eslint-config-standard-jsx": "^4.0.2", "eslint-config-standard-jsx": "^4.0.2",
"eslint-plugin-import": "^2.8.0", "eslint-plugin-import": "^2.8.0",
"eslint-plugin-jasmine": "^2.9.1",
"eslint-plugin-node": "^5.2.1", "eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0", "eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.5.1", "eslint-plugin-react": "^7.5.1",

@ -34,7 +34,7 @@ dependencies:
override: override:
- yes | mix do deps.get, local.rebar, deps.compile, compile - yes | mix do deps.get, local.rebar, deps.compile, compile
- mix dialyzer --plt - mix dialyzer --plt
- cd assets && npm install && cd .. - cd assets && npm install && npm run build && cd ..
cache_directories: cache_directories:
- ~/.asdf - ~/.asdf
- _build - _build

@ -14,6 +14,7 @@ defmodule ExplorerWeb.Router do
font-src 'self' 'unsafe-inline' 'unsafe-eval' data:;\ font-src 'self' 'unsafe-inline' 'unsafe-eval' data:;\
" "
} }
if Mix.env != :prod, do: plug Jasmine, js_files: ["js/test.js"]
plug SetLocale, gettext: ExplorerWeb.Gettext, default_locale: "en" plug SetLocale, gettext: ExplorerWeb.Gettext, default_locale: "en"
end end

@ -37,7 +37,7 @@ defmodule Explorer.Mixfile do
# Specifies extra applications to start per environment # Specifies extra applications to start per environment
defp extra_applications(:prod), do: [:phoenix_pubsub_redis, :new_relixir | extra_applications()] defp extra_applications(:prod), do: [:phoenix_pubsub_redis, :new_relixir | extra_applications()]
defp extra_applications(_), do: extra_applications() defp extra_applications(_), do: extra_applications()
defp extra_applications, do: [:ethereumex, :timex, :timex_ecto, :set_locale, :logger, :runtime_tools] defp extra_applications, do: [:ex_jasmine, :ethereumex, :timex, :timex_ecto, :set_locale, :logger, :runtime_tools]
# Specifies your project dependencies. # Specifies your project dependencies.
# #
@ -51,6 +51,7 @@ defmodule Explorer.Mixfile do
{:ex_machina, "~> 2.1", only: [:test]}, {:ex_machina, "~> 2.1", only: [:test]},
{:exvcr, "~> 0.8", only: :test}, {:exvcr, "~> 0.8", only: :test},
{:gettext, "~> 0.11"}, {:gettext, "~> 0.11"},
{:ex_jasmine, github: "minifast/ex_jasmine", branch: "master"},
{:junit_formatter, ">= 0.0.0"}, {:junit_formatter, ">= 0.0.0"},
{:new_relixir, "~> 0.4.0", only: [:prod]}, {:new_relixir, "~> 0.4.0", only: [:prod]},
{:phoenix, "~> 1.3.0"}, {:phoenix, "~> 1.3.0"},

@ -11,6 +11,7 @@
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"},
"ecto": {:hex, :ecto, "2.2.8", "a4463c0928b970f2cee722cd29aaac154e866a15882c5737e0038bbfcf03ec2c", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"}, "ecto": {:hex, :ecto, "2.2.8", "a4463c0928b970f2cee722cd29aaac154e866a15882c5737e0038bbfcf03ec2c", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
"ethereumex": {:git, "https://github.com/exthereum/ethereumex.git", "262f1d81ae163ffb46e127283658249dac1c8318", []}, "ethereumex": {:git, "https://github.com/exthereum/ethereumex.git", "262f1d81ae163ffb46e127283658249dac1c8318", []},
"ex_jasmine": {:git, "https://github.com/minifast/ex_jasmine.git", "9ce8e8245b3d74efde4b2c6c1a6f56a75d5ade52", [branch: "master"]},
"ex_machina": {:hex, :ex_machina, "2.1.0", "4874dc9c78e7cf2d429f24dc3c4005674d4e4da6a08be961ffccc08fb528e28b", [:mix], [{:ecto, "~> 2.1", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"}, "ex_machina": {:hex, :ex_machina, "2.1.0", "4874dc9c78e7cf2d429f24dc3c4005674d4e4da6a08be961ffccc08fb528e28b", [:mix], [{:ecto, "~> 2.1", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
"exactor": {:hex, :exactor, "2.2.4", "5efb4ddeb2c48d9a1d7c9b465a6fffdd82300eb9618ece5d34c3334d5d7245b1", [:mix], [], "hexpm"}, "exactor": {:hex, :exactor, "2.2.4", "5efb4ddeb2c48d9a1d7c9b465a6fffdd82300eb9618ece5d34c3334d5d7245b1", [:mix], [], "hexpm"},
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"}, "exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},

@ -0,0 +1,11 @@
defmodule ExplorerWeb.JavascriptTest do
use ExplorerWeb.FeatureCase, async: true
import Wallaby.Query, only: [css: 1]
test "runs jasmine", %{session: session} do
session
|> visit("/jasmine")
|> assert_has(css(".jasmine-bar.jasmine-passed"))
end
end
Loading…
Cancel
Save