Commit f22eb1d0 authored by Florent Chehab's avatar Florent Chehab

Added jest for frontend testing. CI updated accordingly.

parent a68b8a4b
Pipeline #35528 passed with stages
in 4 minutes and 22 seconds
...@@ -60,6 +60,19 @@ test_back: ...@@ -60,6 +60,19 @@ test_back:
tags: tags:
- docker - 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: flake8:
stage: lint stage: lint
image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
......
...@@ -2,6 +2,7 @@ module.exports = { ...@@ -2,6 +2,7 @@ module.exports = {
"env": { "env": {
"browser": true, "browser": true,
"es6": true, "es6": true,
"jest/globals": true
}, },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
...@@ -16,7 +17,8 @@ module.exports = { ...@@ -16,7 +17,8 @@ module.exports = {
} }
}, },
"plugins": [ "plugins": [
"react" "react",
"jest",
], ],
"rules": { "rules": {
"indent": [ "indent": [
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"lint-fix": "eslint \"./src/**/*.js\" --fix", "lint-fix": "eslint \"./src/**/*.js\" --fix",
"dev": "node server.js", "dev": "node server.js",
"build": "webpack --config webpack.config.build.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", "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" "view-stats": "webpack-bundle-analyzer --host 0.0.0.0 --port 8888 stats.json"
}, },
...@@ -54,11 +54,14 @@ ...@@ -54,11 +54,14 @@
"@babel/preset-react": "^7.0.0", "@babel/preset-react": "^7.0.0",
"autoprefixer": "^9.4.8", "autoprefixer": "^9.4.8",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"babel-jest": "^24.1.0",
"babel-loader": "^8.0.5", "babel-loader": "^8.0.5",
"css-loader": "^2.1.0", "css-loader": "^2.1.0",
"eslint": "^5.14.1", "eslint": "^5.14.1",
"eslint-plugin-jest": "^22.3.0",
"eslint-plugin-react": "^7.12.4", "eslint-plugin-react": "^7.12.4",
"file-loader": "^3.0.1", "file-loader": "^3.0.1",
"jest": "^24.1.0",
"js-yaml-loader": "^1.0.1", "js-yaml-loader": "^1.0.1",
"mini-css-extract-plugin": "^0.5.0", "mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0", "node-sass": "^4.11.0",
......
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);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment