Skip to content

Commit 04bdd8a

Browse files
committed
Build: Update to latest semistandard
Sorry, I can quite fluidly remember and adapt to different spacing styles between projects with almost no context switch, but absence/presence of semicolons traps I just can't remember to do correctly. Switching to semistandard to align more closely with QUnit and other jQuery projects.
1 parent 6e3bc32 commit 04bdd8a

26 files changed

+2212
-774
lines changed

.eslintrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"root": true,
3+
"extends": "semistandard"
4+
}

.gitignore

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
# Logs
2-
logs
3-
*.log
4-
5-
# Runtime data
6-
pids
7-
*.pid
8-
*.seed
9-
10-
# Directory for instrumented libs generated by jscoverage/JSCover
11-
lib-cov
12-
13-
# Coverage directory used by tools like istanbul
14-
coverage
15-
16-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17-
.grunt
18-
19-
# Compiled binary addons (http://nodejs.org/api/addons.html)
20-
build/Release
21-
22-
# Dependency directory
23-
# Deployed apps should consider commenting this line out:
24-
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
25-
node_modules
26-
27-
dist
1+
/dist
2+
/node_modules
3+
/*.log

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import QUnitAdapter from './lib/adapters/QUnitAdapter.js'
2-
import JasmineAdapter from './lib/adapters/JasmineAdapter.js'
3-
import MochaAdapter from './lib/adapters/MochaAdapter.js'
4-
import TapReporter from './lib/reporters/TapReporter.js'
5-
import ConsoleReporter from './lib/reporters/ConsoleReporter.js'
6-
import {Assertion, TestStart, TestEnd, SuiteStart, SuiteEnd} from './lib/Data.js'
1+
import QUnitAdapter from './lib/adapters/QUnitAdapter.js';
2+
import JasmineAdapter from './lib/adapters/JasmineAdapter.js';
3+
import MochaAdapter from './lib/adapters/MochaAdapter.js';
4+
import TapReporter from './lib/reporters/TapReporter.js';
5+
import ConsoleReporter from './lib/reporters/ConsoleReporter.js';
6+
import {Assertion, TestStart, TestEnd, SuiteStart, SuiteEnd} from './lib/Data.js';
77
import {autoRegister, createSuiteStart, createTestStart,
8-
createTestEnd, createSuiteEnd} from './lib/helpers.js'
8+
createTestEnd, createSuiteEnd} from './lib/helpers.js';
99

1010
export default {
1111
QUnitAdapter,
@@ -23,4 +23,4 @@ export default {
2323
createTestEnd,
2424
createSuiteEnd,
2525
autoRegister
26-
}
26+
};

karma.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ module.exports = function (config) {
4242
browsers: ['PhantomJS'],
4343
singleRun: true,
4444
concurrency: Infinity
45-
})
46-
}
45+
});
46+
};

lib/Data.js

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
11
function getAllTests (suite) {
22
var childSuiteTests = suite.childSuites
33
.map((childSuite) => getAllTests(childSuite))
4-
.reduce((allTests, a) => allTests.concat(a), [])
4+
.reduce((allTests, a) => allTests.concat(a), []);
55

6-
return suite.tests.concat(childSuiteTests)
6+
return suite.tests.concat(childSuiteTests);
77
}
88

99
function getRuntime (suite) {
1010
if (suite.status === 'skipped' || suite.status === undefined) {
11-
return undefined
11+
return undefined;
1212
}
1313

1414
return getAllTests(suite)
1515
.map((test) => test.status === 'skipped' ? 0 : test.runtime)
16-
.reduce((sum, testRuntime) => sum + testRuntime, 0)
16+
.reduce((sum, testRuntime) => sum + testRuntime, 0);
1717
}
1818

1919
function getStatus (suite) {
20-
var passed = 0
21-
var failed = 0
22-
var skipped = 0
23-
var todo = 0
24-
var tests = getAllTests(suite)
20+
var passed = 0;
21+
var failed = 0;
22+
var skipped = 0;
23+
var todo = 0;
24+
var tests = getAllTests(suite);
2525

2626
for (let i = 0; i < tests.length; i++) {
27-
let test = tests[i]
27+
let test = tests[i];
2828

2929
// If a suite contains a test whose status is still undefined,
3030
// there is no final status for the suite as well.
3131
if (test.status === undefined) {
32-
return undefined
32+
return undefined;
3333
} else if (test.status === 'passed') {
34-
passed++
34+
passed++;
3535
} else if (test.status === 'skipped') {
36-
skipped++
36+
skipped++;
3737
} else if (test.status === 'todo') {
38-
todo++
38+
todo++;
3939
} else {
40-
failed++
40+
failed++;
4141
}
4242
}
4343

4444
if (failed > 0) {
45-
return 'failed'
45+
return 'failed';
4646
} else if (skipped > 0 && passed === 0) {
47-
return 'skipped'
47+
return 'skipped';
4848
} else if (todo > 0 && passed === 0) {
49-
return 'todo'
49+
return 'todo';
5050
} else {
51-
return 'passed'
51+
return 'passed';
5252
}
5353
}
5454

5555
function getSuiteStartTestCounts (suite) {
56-
var tests = getAllTests(suite)
56+
var tests = getAllTests(suite);
5757

5858
return {
5959
total: tests.length
60-
}
60+
};
6161
}
6262

6363
function getSuiteEndTestCounts (suite) {
64-
var tests = getAllTests(suite)
64+
var tests = getAllTests(suite);
6565

6666
return {
6767
passed: tests.filter((test) => test.status === 'passed').length,
6868
failed: tests.filter((test) => test.status === 'failed').length,
6969
skipped: tests.filter((test) => test.status === 'skipped').length,
7070
todo: tests.filter((test) => test.status === 'todo').length,
7171
total: tests.length
72-
}
72+
};
7373
}
7474

7575
export class Assertion {
@@ -82,12 +82,12 @@ export class Assertion {
8282
* @param {Boolean} todo
8383
*/
8484
constructor (passed, actual, expected, message, stack, todo) {
85-
this.passed = passed
86-
this.actual = actual
87-
this.expected = expected
88-
this.message = message
89-
this.stack = stack
90-
this.todo = todo
85+
this.passed = passed;
86+
this.actual = actual;
87+
this.expected = expected;
88+
this.message = message;
89+
this.stack = stack;
90+
this.todo = todo;
9191
}
9292
}
9393

@@ -98,9 +98,9 @@ export class TestStart {
9898
* @param {String[]} fullName
9999
*/
100100
constructor (name, suiteName, fullName) {
101-
this.name = name
102-
this.suiteName = suiteName
103-
this.fullName = fullName
101+
this.name = name;
102+
this.suiteName = suiteName;
103+
this.fullName = fullName;
104104
}
105105
}
106106

@@ -115,13 +115,13 @@ export class TestEnd {
115115
* @param {Assertion[]} assertions
116116
*/
117117
constructor (name, suiteName, fullName, status, runtime, errors, assertions) {
118-
this.name = name
119-
this.suiteName = suiteName
120-
this.fullName = fullName
121-
this.status = status
122-
this.runtime = runtime
123-
this.errors = errors
124-
this.assertions = assertions
118+
this.name = name;
119+
this.suiteName = suiteName;
120+
this.fullName = fullName;
121+
this.status = status;
122+
this.runtime = runtime;
123+
this.errors = errors;
124+
this.assertions = assertions;
125125
}
126126
}
127127

@@ -133,11 +133,11 @@ export class SuiteStart {
133133
* @param {Suite[]} childSuites
134134
*/
135135
constructor (name, fullName, tests, childSuites, testCounts) {
136-
this.name = name
137-
this.fullName = fullName
138-
this.tests = tests
139-
this.childSuites = childSuites
140-
this.testCounts = getSuiteStartTestCounts(this)
136+
this.name = name;
137+
this.fullName = fullName;
138+
this.tests = tests;
139+
this.childSuites = childSuites;
140+
this.testCounts = getSuiteStartTestCounts(this);
141141
}
142142
}
143143

@@ -157,12 +157,12 @@ export class SuiteEnd {
157157
*/
158158
constructor (name, fullName, tests, childSuites, status, testCounts,
159159
runtime) {
160-
this.name = name
161-
this.fullName = fullName
162-
this.tests = tests
163-
this.childSuites = childSuites
164-
this.status = status || getStatus(this)
165-
this.testCounts = testCounts || getSuiteEndTestCounts(this)
166-
this.runtime = runtime || getRuntime(this)
160+
this.name = name;
161+
this.fullName = fullName;
162+
this.tests = tests;
163+
this.childSuites = childSuites;
164+
this.status = status || getStatus(this);
165+
this.testCounts = testCounts || getSuiteEndTestCounts(this);
166+
this.runtime = runtime || getRuntime(this);
167167
}
168168
}

0 commit comments

Comments
 (0)