Commit 0394a5b7 authored by Jesús Espino's avatar Jesús Espino Committed by Carlos Tadeu Panato Junior

Merging master into release-5.2 (For include last changes on mobile) (#599)

* Jenkins build improvements (#592)

* remove test-no-mock target

* generate build/test-results.xml in junit format

* switch Jenkinsfile to build using node:8 Docker image

* parse junit tests results for pipeline display

* tidy up stages:
* remove duplicate checkout target, since this occurs automatically
* remove clean ws step since now running in transient containers
* tidy up shell steps (`exit 1` redundant)
* tidy up stage names

* MM-11484 Add check for undefined channel objects (#588)

* MM-11477 Add message to all doFetchWithResponse errors (#595)

* Remove unused Client4 method

* Add message to all doFetchWithResponse errors
parent 111db434
test-results.xml
#!/usr/bin/env groovy
pipeline {
agent any
agent {
docker {
image 'node:8'
}
}
stages {
stage('Checkout') {
steps {
cleanWs()
checkout scm
}
}
stage('Setup Redux') {
stage('Install') {
steps {
sh """
npm install --ignore-scripts || exit 1
touch .npminstall
"""
sh "npm install --ignore-scripts"
}
}
stage('Check style') {
steps {
sh "npm run check || exit 1"
sh "npm run check"
}
}
stage('Run tests without mock server') {
stage('Test') {
steps {
sh "npm run test || exit 1"
sh "npm run test"
}
}
}
post {
always {
junit 'build/test-results.xml'
}
}
}
......@@ -1349,7 +1349,6 @@
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
......@@ -2182,8 +2181,7 @@
"core-js": {
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz",
"integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=",
"dev": true
"integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs="
},
"core-util-is": {
"version": "1.0.2",
......@@ -4304,9 +4302,9 @@
"dev": true,
"optional": true,
"requires": {
"asynckit": "0.4.0",
"combined-stream": "1.0.5",
"mime-types": "2.1.15"
"asynckit": "^0.4.0",
"combined-stream": "^1.0.5",
"mime-types": "^2.1.12"
}
},
"fs.realpath": {
......@@ -4399,8 +4397,8 @@
"dev": true,
"optional": true,
"requires": {
"ajv": "4.11.8",
"har-schema": "1.0.5"
"ajv": "^4.9.1",
"har-schema": "^1.0.5"
}
},
"has-unicode": {
......@@ -4461,7 +4459,7 @@
"bundled": true,
"dev": true,
"requires": {
"number-is-nan": "1.0.1"
"number-is-nan": "^1.0.0"
}
},
"is-typedarray": {
......@@ -4553,7 +4551,7 @@
"bundled": true,
"dev": true,
"requires": {
"mime-db": "1.27.0"
"mime-db": "~1.27.0"
}
},
"minimatch": {
......@@ -4561,7 +4559,7 @@
"bundled": true,
"dev": true,
"requires": {
"brace-expansion": "1.1.7"
"brace-expansion": "^1.1.7"
}
},
"minimist": {
......@@ -5016,7 +5014,7 @@
"resolved": "https://registry.npmjs.org/gfycat-sdk/-/gfycat-sdk-1.4.18.tgz",
"integrity": "sha512-BrINtO6rj8Nr0pm38Qr3epayOuvlKcEFcDCw6yL9T4SrsWTECct6FS/isli766kdij2GGG6bWU6bRp+fDS2Cbg==",
"requires": {
"babel-runtime": "6.26.0"
"babel-runtime": "^6.23.0"
}
},
"github": {
......@@ -6326,6 +6324,57 @@
}
}
},
"mocha-junit-reporter": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/mocha-junit-reporter/-/mocha-junit-reporter-1.17.0.tgz",
"integrity": "sha1-LlFJ7UD8XS48px5C21qx/snG2Fw=",
"dev": true,
"requires": {
"debug": "^2.2.0",
"md5": "^2.1.0",
"mkdirp": "~0.5.1",
"strip-ansi": "^4.0.0",
"xml": "^1.0.0"
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0"
}
}
}
},
"mocha-multi-reporters": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/mocha-multi-reporters/-/mocha-multi-reporters-1.1.7.tgz",
"integrity": "sha1-zH8/TTL0eFIJQdhSq7ZNmYhYfYI=",
"dev": true,
"requires": {
"debug": "^3.1.0",
"lodash": "^4.16.4"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
}
}
},
"mock-socket": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/mock-socket/-/mock-socket-7.1.0.tgz",
......@@ -7373,8 +7422,7 @@
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
"dev": true
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
},
"regenerator-transform": {
"version": "0.10.1",
......@@ -10021,6 +10069,12 @@
"async-limiter": "~1.0.0"
}
},
"xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=",
"dev": true
},
"xtend": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
......
......@@ -41,6 +41,8 @@
"flow-copy-source": "1.3.0",
"flow-typed": "2.4.0",
"mocha": "5.1.1",
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"mock-socket": "7.1.0",
"nock": "9.2.6",
"react": "16.3.2",
......@@ -65,7 +67,6 @@
"flow": "flow",
"flow-typed": "flow-typed",
"test": "NODE_ENV=test mocha --opts test/mocha.opts",
"test-no-mock": "TEST_SERVER=1 NOCK_OFF=true NODE_ENV=test mocha --opts test/mocha.opts",
"prepublishOnly": "npm run build"
}
}
......@@ -619,11 +619,6 @@ export default class Client4 {
);
};
getCurrentSession = async (userId, token) => {
const sessions = await this.getSessions(userId);
return sessions.find((s) => s.token === token);
};
revokeSession = async (userId, sessionId) => {
return this.doFetch(
`${this.getUserRoute(userId)}/sessions/revoke`,
......@@ -2421,6 +2416,7 @@ export default class Client4 {
data = await response.json();
} catch (err) {
throw {
message: 'Received invalid response from the server.',
intl: {
id: 'mobile.request.invalid_response',
defaultMessage: 'Received invalid response from the server.',
......
......@@ -291,7 +291,7 @@ export const getDefaultChannel = createSelector(
getAllChannels,
getCurrentTeamId,
(channels, teamId) => {
return Object.values(channels).find((c) => c.team_id === teamId && c.name === General.DEFAULT_CHANNEL);
return Object.values(channels).find((c) => c && c.team_id === teamId && c.name === General.DEFAULT_CHANNEL);
}
);
......
{
"reporterEnabled": "spec, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "./build/test-results.xml"
}
}
......@@ -3,4 +3,6 @@
--require babel-polyfill
--require isomorphic-fetch
--recursive
--reporter mocha-multi-reporters
--reporter-options configFile=test/mocha-multi-reporters-config.json
--exit
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