Skip to content

Commit affc944

Browse files
Brian M Huntclaude
authored andcommitted
Fix CI: prettier, eslint, karma frameworks, tsconfig types
- Add types: ["mocha", "jquery"] to tsconfig (TS 6 needs explicit) - Remove chai/sinon from karma frameworks (incompatible with chai v6) - Convert builds/knockout helper to ESM imports with esbuild bundling - Restore setTimeout fallback in tasks.ts - Fix .to.be.undefined ESLint errors - Run prettier on 12 unformatted spec files - Remove unused Assertion import and redundant null guard Verified in clean worktree: format, eslint, tsc, and all 27 packages pass (955 SUCCESS for builds/knockout). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 694478e commit affc944

30 files changed

Lines changed: 204 additions & 141 deletions

builds/knockout/helpers/mocha-test-helpers.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
import * as chai from 'chai'
2+
import sinon from 'sinon'
3+
14
;(function (global) {
5+
const { expect } = chai
6+
global.chai = chai
7+
global.sinon = sinon
8+
global.expect = expect
9+
210
function restoreAfter(cleanups, object, propertyName) {
311
const originalValue = object[propertyName]
412
cleanups.push(function () {

builds/knockout/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
],
3232
"karma": {
3333
"frameworks": [
34-
"mocha",
35-
"chai",
36-
"sinon"
34+
"mocha"
3735
],
3836
"files": [
3937
"dist/browser.min.js",

packages/bind/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
"homepage": "https://tko.io",
3131
"karma": {
3232
"frameworks": [
33-
"mocha",
34-
"chai",
35-
"sinon"
33+
"mocha"
3634
]
3735
},
3836
"__about__": "These are copied into all packages/*/package.json",

packages/binding.component/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
],
2121
"karma": {
2222
"frameworks": [
23-
"mocha",
24-
"chai",
25-
"sinon"
23+
"mocha"
2624
]
2725
},
2826
"homepage": "https://tko.io",

packages/binding.component/spec/componentBindingBehaviors.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ import components from '@tko/utils.component'
2626

2727
import { expect } from 'chai'
2828
import sinon from 'sinon'
29-
import { expectContainHtml, expectContainText, prepareTestNode, restoreAfter, useMockForTasks } from '../../utils/helpers/mocha-test-helpers'
29+
import {
30+
expectContainHtml,
31+
expectContainText,
32+
prepareTestNode,
33+
restoreAfter,
34+
useMockForTasks
35+
} from '../../utils/helpers/mocha-test-helpers'
3036

3137
describe('Components: Component binding', function () {
3238
let testComponentName = 'test-component',
@@ -100,9 +106,7 @@ describe('Components: Component binding', function () {
100106
testNode.innerHTML = '<div data-bind="if: true, component: $data"></div>'
101107
expect(function () {
102108
applyBindings(testComponentName, testNode)
103-
}).to.throw(
104-
'Multiple bindings (if and component) are trying to control descendant bindings of the same element.'
105-
)
109+
}).to.throw('Multiple bindings (if and component) are trying to control descendant bindings of the same element.')
106110

107111
// Even though applyBindings threw an exception, the component still gets bound (asynchronously)
108112
clock.tick(1)
@@ -241,7 +245,8 @@ describe('Components: Component binding', function () {
241245
applyBindings(outerViewModel, testNode)
242246
clock.tick(1)
243247

244-
expectContainHtml(testNode.children[0],
248+
expectContainHtml(
249+
testNode.children[0],
245250
'start<span data-bind="template: { nodes: $componenttemplatenodes }"><em>original</em> child nodes</span>end'
246251
)
247252
})
@@ -274,7 +279,8 @@ describe('Components: Component binding', function () {
274279
applyBindings(outerViewModel, testNode)
275280
clock.tick(1)
276281

277-
expectContainText(testNode.children[0],
282+
expectContainText(
283+
testNode.children[0],
278284
'In child context 123, inside component with property 456. Now in sub-component with property 789.',
279285
/* ignoreSpaces */ true
280286
) // Ignore spaces because old-IE is inconsistent
@@ -1383,7 +1389,9 @@ describe('Components: Component binding', function () {
13831389
)
13841390

13851391
arr([])
1386-
expect(testNode.innerHTML).to.deep.equal(`<test-component><div><!--ko slot: "X"--><!--/ko--></div></test-component>`)
1392+
expect(testNode.innerHTML).to.deep.equal(
1393+
`<test-component><div><!--ko slot: "X"--><!--/ko--></div></test-component>`
1394+
)
13871395
})
13881396

13891397
it('respects observable array changes with JSX', function () {

packages/binding.core/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
},
3232
"karma": {
3333
"frameworks": [
34-
"mocha",
35-
"chai",
36-
"sinon"
34+
"mocha"
3735
]
3836
},
3937
"licenses": [

packages/binding.core/spec/optionsBehaviors.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,11 @@ describe('Binding: Options', function () {
234234
})
235235
applyBindings({ myValues: myObservable }, testNode)
236236
expect(changeHandlerFireCount).to.equal(0)
237-
238237
;(testNode.childNodes[0] as HTMLSelectElement).options[0].selected = true
239238
expectHaveSelectedValues(testNode.childNodes[0], ['A'])
240239
myObservable(['B', 'C', 'A'])
241240
expectHaveSelectedValues(testNode.childNodes[0], ['A'])
242241
expect(changeHandlerFireCount).to.equal(0)
243-
244242
;(testNode.childNodes[0] as HTMLSelectElement).options[0].selected = true
245243
expectHaveSelectedValues(testNode.childNodes[0], ['B', 'A'])
246244
myObservable(['C', 'A'])
@@ -319,7 +317,7 @@ describe('Binding: Options', function () {
319317
{ name: observable('Bert'), id: 'B' }
320318
]
321319
testNode.innerHTML =
322-
'<select data-bind="options: people, optionsText: \'name\', optionsValue: \'id\', optionsCaption: \'-\'"></select>'
320+
"<select data-bind=\"options: people, optionsText: 'name', optionsValue: 'id', optionsCaption: '-'\"></select>"
323321
applyBindings({ people: people }, testNode)
324322
;(testNode.childNodes[0] as HTMLSelectElement).options[2].selected = true
325323

packages/binding.core/spec/textBehaviors.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import { options } from '@tko/utils'
1212
import * as coreBindings from '../dist'
1313

1414
import { Provider } from '@tko/provider'
15-
import { expectContainHtml, expectContainText, prepareTestNode, restoreAfter } from '../../utils/helpers/mocha-test-helpers'
15+
import {
16+
expectContainHtml,
17+
expectContainText,
18+
prepareTestNode,
19+
restoreAfter
20+
} from '../../utils/helpers/mocha-test-helpers'
1621

1722
describe('Binding: Text', function () {
1823
let bindingHandlers

packages/binding.core/spec/usingBehaviors.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,7 @@ describe('Binding: Using', function () {
169169
expectContainHtml(container, '<div data-bind="foreach: childprop"></div>')
170170

171171
childprop.push('me')
172-
expectContainHtml(
173-
container,
174-
'<div data-bind="foreach: childprop"><span data-bind=\"text: $data\">me</span></div>'
175-
)
172+
expectContainHtml(container, '<div data-bind="foreach: childprop"><span data-bind=\"text: $data\">me</span></div>')
176173

177174
childprop.push('me2')
178175
expectContainHtml(
@@ -201,7 +198,10 @@ describe('Binding: Using', function () {
201198
expectContainHtml(container, 'text<!-- ko foreach: childprop --><!-- /ko -->')
202199

203200
childprop.push('me')
204-
expectContainHtml(container, 'text<!-- ko foreach: childprop --><span data-bind="text: $data">me</span><!-- /ko -->')
201+
expectContainHtml(
202+
container,
203+
'text<!-- ko foreach: childprop --><span data-bind="text: $data">me</span><!-- /ko -->'
204+
)
205205

206206
childprop.push('me2')
207207
expectContainHtml(

packages/binding.if/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
},
3232
"karma": {
3333
"frameworks": [
34-
"mocha",
35-
"chai",
36-
"sinon"
34+
"mocha"
3735
]
3836
},
3937
"licenses": [

0 commit comments

Comments
 (0)