Skip to content

Commit

Permalink
Move globals of test to a specific eslintrc file (#12959)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Dec 17, 2018
1 parent d1b6211 commit 5b3ca5d
Show file tree
Hide file tree
Showing 35 changed files with 17 additions and 137 deletions.
2 changes: 0 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"AccountBox" : false,
"Apps" : false,
"Assets" : false,
"browser" : false,
"ChatMessage" : false,
"ChatMessages" : false,
"ChatRoom" : false,
Expand All @@ -24,7 +23,6 @@
"Settings" : false,
"SideNav" : false,
"t" : false,
"TimeSync" : false,
"VideoRecorder" : false,
"VRecDialog" : false
}
Expand Down
12 changes: 12 additions & 0 deletions tests/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"env": {
"mocha": true
},
"globals": {
"browser": false,
"expect": false,
"FlowRouter": false,
"Meteor": false,
"RocketChat": false
}
}
2 changes: 0 additions & 2 deletions tests/data/checks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* globals Meteor */

import loginPage from '../pageobjects/login.page';
import mainContent from '../pageobjects/main-content.page';
import sideNav from '../pageobjects/side-nav.page';
Expand Down
5 changes: 0 additions & 5 deletions tests/end-to-end/api/00-miscellaneous.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import { getCredentials, api, login, request, credentials } from '../../data/api-data.js';
import { adminEmail, adminUsername, adminPassword, password } from '../../data/user.js';
import supertest from 'supertest';

describe('miscellaneous', function() {
this.retries(0);
Expand Down
7 changes: 1 addition & 6 deletions tests/end-to-end/api/01-users.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import crypto from 'crypto';
import {
getCredentials,
api,
login,
request,
credentials,
apiEmail,
Expand Down Expand Up @@ -989,7 +984,7 @@ describe('[Users]', function() {
});
});

describe('Testing if the returned token is valid:', (done) => {
describe('Testing if the returned token is valid:', () => {
it('should return 200', (done) => request.post(api('users.createToken'))
.set(credentials)
.send({ username: user.username })
Expand Down
12 changes: 1 addition & 11 deletions tests/end-to-end/api/02-channels.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import {
getCredentials,
api,
login,
request,
credentials,
apiEmail,
apiUsername,
targetUser,
log,
apiPublicChannelName,
channel,
} from '../../data/api-data.js';
import { adminEmail, password, adminUsername } from '../../data/user.js';
import supertest from 'supertest';
import { adminUsername } from '../../data/user.js';

function getRoomInfo(roomId) {
return new Promise((resolve/* , reject*/) => {
Expand Down
8 changes: 1 addition & 7 deletions tests/end-to-end/api/03-groups.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import { getCredentials, api, login, request, credentials, group, log, apiPrivateChannelName } from '../../data/api-data.js';
import { adminEmail, password } from '../../data/user.js';
import supertest from 'supertest';
import { getCredentials, api, request, credentials, group, apiPrivateChannelName } from '../../data/api-data.js';
import { adminUsername } from '../../data/user';

function getRoomInfo(roomId) {
Expand Down
9 changes: 1 addition & 8 deletions tests/end-to-end/api/04-direct-message.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import {
getCredentials,
api,
login,
request,
credentials,
directMessage,
log,
apiUsername,
apiEmail,
} from '../../data/api-data.js';
import { adminEmail, password } from '../../data/user.js';
import supertest from 'supertest';
import { password } from '../../data/user.js';
import { adminUsername } from '../../data/user';

describe('[Direct Messages]', function() {
Expand Down
4 changes: 0 additions & 4 deletions tests/end-to-end/api/05-chat.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import {
getCredentials,
api,
Expand Down
8 changes: 1 addition & 7 deletions tests/end-to-end/api/06-outgoing-integrations.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import { getCredentials, api, login, request, credentials, integration, log } from '../../data/api-data.js';
import { adminEmail, password } from '../../data/user.js';
import supertest from 'supertest';
import { api, request, credentials, integration } from '../../data/api-data.js';

describe('Outgoing Integrations', function() {
this.retries(0);
Expand Down
2 changes: 0 additions & 2 deletions tests/end-to-end/api/07-incoming-integrations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env mocha */

import { getCredentials, api, request, credentials } from '../../data/api-data.js';

describe('Incoming Integrations', function() {
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/api/08-settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals expect */

import { getCredentials, api, request, credentials } from '../../data/api-data.js';

describe('[Settings]', function() {
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/api/09-rooms.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals expect */

import { getCredentials, api, request, credentials } from '../../data/api-data.js';
import { password } from '../../data/user';
import { closeRoom, createRoom } from '../../data/rooms.helper';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/api/10-subscriptions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals expect */

import { getCredentials, api, request, credentials } from '../../data/api-data.js';

describe('[Subscriptions]', function() {
Expand Down
2 changes: 0 additions & 2 deletions tests/end-to-end/api/11-graphql.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env mocha */

const supertest = require('supertest');
const request = supertest('http://localhost:3000');

Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/api/11-permissions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals expect */

import { getCredentials, api, request, credentials } from '../../data/api-data.js';

describe('[Permissions]', function() {
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/api/12-emoji-custom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals expect */

import { getCredentials, api, request, credentials } from '../../data/api-data.js';

describe('[EmojiCustom]', function() {
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/api/13-roles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals expect */

import {
getCredentials,
api,
Expand Down
4 changes: 0 additions & 4 deletions tests/end-to-end/api/14-assets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import {
getCredentials,
api,
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/00-login.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals Meteor, FlowRouter */

import loginPage from '../../pageobjects/login.page';
import setupWizard from '../../pageobjects/setup-wizard.page';

Expand Down
2 changes: 0 additions & 2 deletions tests/end-to-end/ui/01-register.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env mocha */

import loginPage from '../../pageobjects/login.page';

describe('[Register]', () => {
Expand Down
2 changes: 0 additions & 2 deletions tests/end-to-end/ui/02-forgot-password.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env mocha */

import loginPage from '../../pageobjects/login.page';

describe('[Forgot Password]', () => {
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/03-user-creation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import loginPage from '../../pageobjects/login.page';
import mainContent from '../../pageobjects/main-content.page';

Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/04-main-elements-render.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import flexTab from '../../pageobjects/flex-tab.page';
import mainContent from '../../pageobjects/main-content.page';
import sideNav from '../../pageobjects/side-nav.page';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/05-channel-creation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import sideNav from '../../pageobjects/side-nav.page';
import { publicChannelName, privateChannelName } from '../../data/channel.js';
import { targetUser } from '../../data/interactions.js';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/06-messaging.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import mainContent from '../../pageobjects/main-content.page';
import sideNav from '../../pageobjects/side-nav.page';
import Global from '../../pageobjects/global';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/07-emoji.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import mainContent from '../../pageobjects/main-content.page';
import sideNav from '../../pageobjects/side-nav.page';

Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/08-resolutions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import Global from '../../pageobjects/global';
import mainContent from '../../pageobjects/main-content.page';
import sideNav from '../../pageobjects/side-nav.page';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/09-channel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import flexTab from '../../pageobjects/flex-tab.page';
import mainContent from '../../pageobjects/main-content.page';
import sideNav from '../../pageobjects/side-nav.page';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/10-user-preferences.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import flexTab from '../../pageobjects/flex-tab.page';
import mainContent from '../../pageobjects/main-content.page';
import sideNav from '../../pageobjects/side-nav.page';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/11-admin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import sideNav from '../../pageobjects/side-nav.page';
import flexTab from '../../pageobjects/flex-tab.page';
import admin from '../../pageobjects/administration.page';
Expand Down
17 changes: 0 additions & 17 deletions tests/end-to-end/ui/12-settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */

import loginPage from '../../pageobjects/login.page';
import supertest from 'supertest';
const request = supertest('http://localhost:3000');
Expand All @@ -14,22 +10,13 @@ import admin from '../../pageobjects/administration.page';

// test data imports
import { checkIfUserIsValid, checkIfUserIsAdmin } from '../../data/checks';
import { targetUser, imgURL } from '../../data/interactions.js';

import { adminUsername, adminEmail, adminPassword, username, email, password, reason } from '../../data/user.js';

function api(path) {
return prefix + path;
}

function log(res) {
console.log(res.req.path);
console.log({
body: res.body,
headers: res.headers,
});
}

const credentials = {
['X-Auth-Token']: undefined,
['X-User-Id']: undefined,
Expand All @@ -40,10 +27,6 @@ const login = {
password: adminPassword,
};

const settingValue = {
value : undefined,
};

describe('[Api Settings Change]', () => {
before((done) => {
checkIfUserIsValid(username, email, password);
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/13-permissions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import sideNav from '../../pageobjects/side-nav.page';
import flexTab from '../../pageobjects/flex-tab.page';
import admin from '../../pageobjects/administration.page';
Expand Down
3 changes: 0 additions & 3 deletions tests/end-to-end/ui/14-message-popup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */
/* globals Meteor */

import { adminEmail, adminPassword } from '../../data/user.js';

import {
Expand Down
2 changes: 0 additions & 2 deletions tests/pageobjects/setup-wizard.page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* globals Meteor */

import Page from './Page';
import { adminEmail, adminPassword } from '../data/user';

Expand Down

0 comments on commit 5b3ca5d

Please sign in to comment.