diff --git a/test/.eslintrc.js b/test/.eslintrc.js index f2b7dc4fb..de00377a7 100644 --- a/test/.eslintrc.js +++ b/test/.eslintrc.js @@ -4,6 +4,8 @@ module.exports = { mocha: true, }, rules: { - 'import/no-dynamic-require': 'off' + 'func-names': 'off', + 'import/no-dynamic-require': 'off', + 'space-before-function-paren': 'off', } }; diff --git a/test/assertions.js b/test/assertions.js index 16e215f45..0ba7db4f5 100644 --- a/test/assertions.js +++ b/test/assertions.js @@ -1,8 +1,6 @@ const should = require('should'); const { DateTime } = require('luxon'); -/* eslint-disable space-before-function-paren, func-names */ - // debugging things. // eslint-disable-next-line no-console global.tap = (x) => { console.log(x); return x; }; diff --git a/test/integration/other/analytics-queries.js b/test/integration/other/analytics-queries.js index 5d7648747..a0948c821 100644 --- a/test/integration/other/analytics-queries.js +++ b/test/integration/other/analytics-queries.js @@ -97,7 +97,6 @@ const submitToForm = (service, user, projectId, xmlFormId, xml, deviceId = 'abcd //////////////////////////////////////////////////////////////////////////////// // Tests! //////////////////////////////////////////////////////////////////////////////// -// eslint-disable-next-line func-names describe('analytics task queries', function () { // increasing timeouts on this set of tests this.timeout(8000); diff --git a/test/integration/other/migrations.js b/test/integration/other/migrations.js index 8b6354a4e..bd5da0fa1 100644 --- a/test/integration/other/migrations.js +++ b/test/integration/other/migrations.js @@ -41,7 +41,6 @@ const testMigration = (filename, tests, options = {}) => { // eslint-disable-next-line no-only-tests/no-only-tests ? describe.only.bind(describe) : (skip ? describe.skip.bind(describe) : describe); - // eslint-disable-next-line func-names, space-before-function-paren f(`database migrations: ${filename}`, function() { this.timeout(20000); @@ -60,7 +59,6 @@ testMigration.skip = (filename, tests) => // column to projects and forms, it is not possible to migrate part way // (before the new column) and populate the data when frames expect the // new column to exist. -// eslint-disable-next-line space-before-function-paren, func-names describe.skip('database migrations', function() { this.timeout(8000); @@ -220,7 +218,6 @@ describe.skip('database migrations', function() { }); -// eslint-disable-next-line space-before-function-paren, func-names describe('database migrations: removing default project', function() { this.timeout(8000); @@ -258,7 +255,6 @@ describe('database migrations: removing default project', function() { })); }); -// eslint-disable-next-line space-before-function-paren, func-names describe('database migrations: intermediate form schema', function() { this.timeout(20000); @@ -388,7 +384,6 @@ describe('database migrations: intermediate form schema', function() { })); }); -// eslint-disable-next-line func-names, space-before-function-paren describe('database migrations: 20230123-01-remove-google-backups', function() { this.timeout(20000); @@ -483,7 +478,6 @@ describe('database migrations: 20230123-01-remove-google-backups', function() { })); }); -// eslint-disable-next-line func-names describe.skip('database migrations: 20230324-01-edit-dataset-verbs.js', function () { this.timeout(20000); @@ -520,7 +514,6 @@ describe.skip('database migrations: 20230324-01-edit-dataset-verbs.js', function })); }); -// eslint-disable-next-line func-names describe.skip('database migrations from 20230406: altering entities and entity_defs', function () { this.timeout(20000); @@ -615,7 +608,6 @@ describe.skip('database migrations from 20230406: altering entities and entity_d })); }); -// eslint-disable-next-line func-names describe('database migrations from 20230512: adding entity_def_sources table', function () { this.timeout(20000); diff --git a/test/integration/setup.js b/test/integration/setup.js index 08718d3ff..025001ebe 100644 --- a/test/integration/setup.js +++ b/test/integration/setup.js @@ -87,7 +87,6 @@ const initialize = async () => { return withDefaults({ db, context, enketo, env, s3 }).transacting(populate); }; -// eslint-disable-next-line func-names, space-before-function-paren before(function() { this.timeout(0); return initialize(); @@ -99,7 +98,6 @@ beforeEach(() => { if(mustReinitAfter) throw new Error(`Failed to reinitalize after previous test: '${mustReinitAfter}'. You may need to increase your mocha timeout.`); s3.resetMock(); }); -// eslint-disable-next-line func-names, space-before-function-paren afterEach(async function() { this.timeout(0); if (mustReinitAfter) { @@ -156,7 +154,6 @@ const testService = (test) => () => new Promise((resolve, reject) => { // for some tests we explicitly need to make concurrent requests, in which case // the transaction butchering we do for testService will not work. for these cases, // we offer testServiceFullTrx: -// eslint-disable-next-line space-before-function-paren, func-names const testServiceFullTrx = (test) => function() { mustReinitAfter = this.test.fullTitle(); return test(augment(request(service(baseContainer))), baseContainer); @@ -172,7 +169,6 @@ const testContainer = (test) => () => new Promise((resolve, reject) => { }); // complete the square of options: -// eslint-disable-next-line space-before-function-paren, func-names const testContainerFullTrx = (test) => function() { mustReinitAfter = this.test.fullTitle(); return test(baseContainer); diff --git a/test/unit/external/enketo.js b/test/unit/external/enketo.js index bcdd0b918..276dba92f 100644 --- a/test/unit/external/enketo.js +++ b/test/unit/external/enketo.js @@ -18,7 +18,6 @@ describe('external/enketo', () => { it('should send a properly constructed request to Enketo', () => { enketoNock .post('/enketoPath/api/v2/survey/all') - // eslint-disable-next-line space-before-function-paren, func-names .reply(201, function(uri, requestBody) { const base64Auth = Buffer.from('enketoApiKey:').toString('base64'); const expectedQueryString = querystring.stringify({ server_url: openRosaUrl, form_id: xmlFormId }); @@ -87,7 +86,6 @@ describe('external/enketo', () => { let run = false; enketoNock .post('/enketoPath/api/v2/instance') - // eslint-disable-next-line space-before-function-paren, func-names .reply(201, function(uri, requestBody) { run = true; const base64Auth = Buffer.from('enketoApiKey:').toString('base64'); diff --git a/test/unit/http/endpoint.js b/test/unit/http/endpoint.js index a0a3b2864..3d315b492 100644 --- a/test/unit/http/endpoint.js +++ b/test/unit/http/endpoint.js @@ -14,13 +14,11 @@ const Problem = require(appRoot + '/lib/util/problem'); const createModernResponse = () => { const result = createResponse({ eventEmitter: EventEmitter }); // node-mocks-http does not have hasHeader yet. - // eslint-disable-next-line space-before-function-paren, func-names result.hasHeader = function(name) { return this.getHeader(name) != null; }; // express adds this. - // eslint-disable-next-line space-before-function-paren, func-names result.status = function(code) { this.statusCode = code; return this; @@ -465,7 +463,6 @@ describe('endpoints', () => { result.should.equal('ateststream'); done(); }); - // eslint-disable-next-line space-before-function-paren, func-names responseTest.hasHeader = function() { return true; }; defaultResultWriter(streamTest.fromChunks([ 'a', 'test', 'stream' ]), requestTest, responseTest); }); @@ -477,7 +474,6 @@ describe('endpoints', () => { result.should.equal('a!test!stream!'); done(); }); - // eslint-disable-next-line space-before-function-paren, func-names responseTest.hasHeader = function() { return true; }; const resourceResult = PartialPipe.of( @@ -501,9 +497,7 @@ describe('endpoints', () => { (result === undefined).should.equal(true); // post node v14.?? done(); }); - // eslint-disable-next-line space-before-function-paren, func-names responseTest.addTrailers = function(t) { trailers = t; }; - // eslint-disable-next-line space-before-function-paren, func-names responseTest.hasHeader = function() { return true; }; const resourceResult = PartialPipe.of( @@ -522,9 +516,8 @@ describe('endpoints', () => { it('should call next on PartialPipe stream error', (done) => { const requestTest = streamTest.fromChunks(); const responseTest = streamTest.toText(() => {}); - // eslint-disable-next-line no-undef, space-before-function-paren, func-names + // eslint-disable-next-line no-undef responseTest.addTrailers = function(t) { trailers = t; }; - // eslint-disable-next-line space-before-function-paren, func-names responseTest.hasHeader = function() { return true; }; const resourceResult = PartialPipe.of( @@ -545,7 +538,6 @@ describe('endpoints', () => { it('should not crash if the request is aborted but the stream is not endable', () => { const requestTest = new EventEmitter(); const responseTest = streamTest.toText(() => {}); - // eslint-disable-next-line space-before-function-paren, func-names responseTest.hasHeader = function() { return true; }; const source = streamTest.fromChunks([ 'a', 'test', 'stream' ], 20); defaultResultWriter(source, requestTest, responseTest); diff --git a/test/unit/util/http.js b/test/unit/util/http.js index 70f302a36..3277e5491 100644 --- a/test/unit/util/http.js +++ b/test/unit/util/http.js @@ -51,7 +51,7 @@ describe('util/http', () => { describe('format response helpers', () => { const { contentType, xml, atom, json } = http; - // eslint-disable-next-line semi, space-before-function-paren, object-shorthand, func-names + // eslint-disable-next-line semi, object-shorthand const mockResponse = () => ({ type: function(value) { this.contentType = value } }); it('should ultimately return the result', () => { contentType()(42)(null, mockResponse()).should.equal(42);