Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Jerphanion
Rex Dri
Commits
f22eb1d0
Commit
f22eb1d0
authored
Feb 26, 2019
by
Florent Chehab
Browse files
Added jest for frontend testing. CI updated accordingly.
parent
a68b8a4b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
f22eb1d0
...
...
@@ -60,6 +60,19 @@ test_back:
tags
:
-
docker
test_frontend
:
stage
:
test
image
:
node:10.15.1-alpine
cache
:
paths
:
-
frontend/node_modules/
before_script
:
-
cd frontend && npm i
script
:
-
npm run test
tags
:
-
docker
flake8
:
stage
:
lint
image
:
registry.gitlab.utc.fr/rex-dri/rex-dri/backend
...
...
frontend/.eslintrc.js
View file @
f22eb1d0
...
...
@@ -2,6 +2,7 @@ module.exports = {
"
env
"
:
{
"
browser
"
:
true
,
"
es6
"
:
true
,
"
jest/globals
"
:
true
},
"
extends
"
:
[
"
eslint:recommended
"
,
...
...
@@ -16,7 +17,8 @@ module.exports = {
}
},
"
plugins
"
:
[
"
react
"
"
react
"
,
"
jest
"
,
],
"
rules
"
:
{
"
indent
"
:
[
...
...
frontend/package-lock.json
View file @
f22eb1d0
This diff is collapsed.
Click to expand it.
frontend/package.json
View file @
f22eb1d0
...
...
@@ -8,7 +8,7 @@
"lint-fix"
:
"eslint
\"
./src/**/*.js
\"
--fix"
,
"dev"
:
"node server.js"
,
"build"
:
"webpack --config webpack.config.build.js"
,
"test"
:
"
echo
\"
Error: no test specified
\"
&& exit 1
"
,
"test"
:
"
jest
"
,
"stats"
:
"webpack --config webpack.config.build.js --profile --json > stats.json"
,
"view-stats"
:
"webpack-bundle-analyzer --host 0.0.0.0 --port 8888 stats.json"
},
...
...
@@ -54,11 +54,14 @@
"@babel/preset-react"
:
"^7.0.0"
,
"autoprefixer"
:
"^9.4.8"
,
"babel-eslint"
:
"^10.0.1"
,
"babel-jest"
:
"^24.1.0"
,
"babel-loader"
:
"^8.0.5"
,
"css-loader"
:
"^2.1.0"
,
"eslint"
:
"^5.14.1"
,
"eslint-plugin-jest"
:
"^22.3.0"
,
"eslint-plugin-react"
:
"^7.12.4"
,
"file-loader"
:
"^3.0.1"
,
"jest"
:
"^24.1.0"
,
"js-yaml-loader"
:
"^1.0.1"
,
"mini-css-extract-plugin"
:
"^0.5.0"
,
"node-sass"
:
"^4.11.0"
,
...
...
frontend/tests/utils/areSameObjects.test.js
0 → 100644
View file @
f22eb1d0
import
areSameObjects
from
"
../../src/utils/areSameObjects
"
;
// a very basic test to check that the areSameObjects function performs as expected
test
(
"
Are same objects
"
,
()
=>
{
const
a
=
{
test
:
true
},
b
=
{
test
:
true
};
expect
(
areSameObjects
(
a
,
b
)).
toBe
(
true
);
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment