Skip to content

Commit ecadb9e

Browse files
committed
test(js): lint JS test files
1 parent bc9b8ad commit ecadb9e

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "4.1.3-SNAPSHOT",
44
"description": "Documentation package for eXist-db",
55
"scripts": {
6-
"test": "mocha src/test/mocha/ --recursive --exit",
6+
"test": "standard 'src/test/**/*.js' && mocha src/test/mocha/ --recursive --exit",
77
"cypress": "cypress run"
88
},
99
"repository": {
@@ -23,6 +23,11 @@
2323
"url": "https://github.com/eXist-db/documentation/issues"
2424
},
2525
"homepage": "https://github.com/eXist-db/documentation#readme",
26+
"standard": {
27+
"env": [
28+
"mocha"
29+
]
30+
},
2631
"devDependencies": {
2732
"acorn": "^6.1.1",
2833
"chai": "^4.2.0",

src/test/cypress/integration/diagnostic_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global cy */
12
/// <reference types="cypress" />
23

34
// This is very slow and therefore skipped. Once diagnostics are re-written
@@ -6,8 +7,7 @@
67

78
context.skip('Diagnostics', () => {
89
before(() => {
9-
cy.visit('/diagnostics.html', {responseTimeout: 60000})
10-
10+
cy.visit('/diagnostics.html', { responseTimeout: 60000 })
1111
})
1212
it('should not find dead links', () => {
1313
cy.get('h1')

src/test/cypress/integration/documentation_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global cy */
12
/// <reference types="cypress" />
23

34
context('Documentation', () => {
@@ -28,7 +29,6 @@ context('Documentation', () => {
2829
.parents('section')
2930
.contains('Integration Testing')
3031
})
31-
3232
})
3333

3434
it('should have ToC links', () => {

src/test/mocha/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const assert = require('assert')
22

33
// this is a dummy test js tests are wip
4-
describe('Array', function() {
5-
describe('#indexOf()', function() {
6-
it('should return -1 when the value is not present', function() {
7-
assert.equal([1,2,3].indexOf(4), -1);
4+
describe('Array', function () {
5+
describe('#indexOf()', function () {
6+
it('should return -1 when the value is not present', function () {
7+
assert.strictEqual([1, 2, 3].indexOf(4), -1)
88
})
99
})
1010
})

src/test/mocha/xqSuite.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
const chai = require('chai')
21
const supertest = require('supertest')
3-
const expect = require('chai').expect
42

53
// The client listening to the mock rest server
64
var client = supertest.agent('http://localhost:8080')
75

8-
describe('running XQsuite test …', function() {
6+
describe('running XQsuite test …', function () {
97
this.timeout(60000)
108
this.slow(45000)
119
let runner = '/exist/rest/db/apps/doc/modules/test-runner.xql'
1210

13-
it('returns 0 errors or failures', function(done) {
11+
it('returns 0 errors or failures', function (done) {
1412
client
1513
.get(runner)
1614
.set('Accept', 'application/json')
1715
.expect('content-type', 'application/json; charset=utf-8')
18-
.end(function(err, res) {
16+
.end(function (err, res) { // eslint-disable-line handle-callback-err
1917
try {
2018
console.group()
2119
console.group()
@@ -26,14 +24,14 @@ describe('running XQsuite test …', function() {
2624
done(err)
2725
} finally {
2826
console.group()
29-
res.body.testsuite.testcase.forEach(function(entry) {
27+
res.body.testsuite.testcase.forEach(function (entry) {
3028
if (entry.failure) {
3129
console.error([entry.name, entry.failure.message])
3230
process.exit(1)
3331
} else if (entry.error) {
3432
console.error([entry.name, entry.error.message])
3533
process.exit(1)
36-
} else(console.log(entry.name))
34+
} else (console.log(entry.name))
3735
})
3836
console.groupEnd()
3937
}

0 commit comments

Comments
 (0)