Skip to content

Commit b28cc90

Browse files
committed
should.js is now deprecated. Switch to chai.
1 parent 6ec5744 commit b28cc90

File tree

4 files changed

+115
-78
lines changed

4 files changed

+115
-78
lines changed

package-lock.json

Lines changed: 103 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,18 @@
4646
"semver": "^7.5.3"
4747
},
4848
"devDependencies": {
49+
"@types/chai": "4.3.5",
4950
"@types/mocha": "^10.0.1",
5051
"@types/node": "^20.3.3",
5152
"@types/semver": "^7.5.0",
5253
"@typescript-eslint/eslint-plugin": "5.60.1",
5354
"@typescript-eslint/parser": "5.60.1",
5455
"c8": "8.0.0",
56+
"chai": "4.3.7",
5557
"eslint": "8.44.0",
5658
"eslint-plugin-jsdoc": "46.4.3",
5759
"mocha": "^10.2.0",
5860
"rimraf": "^5.0.1",
59-
"should": "^13.2.3",
6061
"typescript": "^5.1.6"
6162
},
6263
"pnpm": {

src/cli.test.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import 'should'
2-
1+
import 'chai/register-should.js'
32
import cli from './cli'
43
import type { Props } from './index'
54

@@ -43,17 +42,17 @@ async function exec(...args: string[]): Promise<Results> {
4342
describe('Command line interface', () => {
4443
it('helps', async () => {
4544
const res = await exec('--help')
46-
res.stdout.should.startWith('Usage:')
45+
res.stdout.should.match(/^Usage:/)
4746
})
4847

4948
it('Lists files', async() => {
5049
const res = await exec('foo.md', '--files')
51-
res.stdout.trim().should.endWith('.editorconfig [*.md]')
50+
res.stdout.trim().should.match(/\.editorconfig \[\*\.md\]$/)
5251
})
5352

5453
it('Lists multiple files', async() => {
5554
const res = await exec('foo.md', 'bar.js', '--files')
56-
res.stdout.should.startWith('[foo.md]')
57-
res.stdout.trim().should.endWith('.editorconfig [*]')
55+
res.stdout.should.match(/^\[foo\.md\]/)
56+
res.stdout.trim().should.match(/\.editorconfig \[\*\]$/)
5857
})
5958
})

src/index.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/naming-convention */
22
import * as fs from 'fs'
33
import * as path from 'path'
4-
import 'should'
4+
import 'chai/register-should.js'
55

66
import * as editorconfig from './'
77

@@ -31,7 +31,7 @@ describe('parse', () => {
3131
cfg.should.eql(expected)
3232
visited.should.have.lengthOf(1)
3333
visited[0].glob.should.eql('*')
34-
visited[0].fileName.should.endWith('.editorconfig')
34+
visited[0].fileName.should.match(/\.editorconfig$/)
3535
})
3636

3737
it('caches', async () => {
@@ -196,8 +196,8 @@ indent_size = 4
196196
[!(package).json]
197197
indent_size = 3`))
198198

199-
matcher(path.join(__dirname, 'package.json')).should.match({ indent_size: 4 })
200-
matcher(path.join(__dirname, 'foo.json')).should.match({ indent_size: 3 })
199+
matcher(path.join(__dirname, 'package.json')).should.include({ indent_size: 4 })
200+
matcher(path.join(__dirname, 'foo.json')).should.include({ indent_size: 3 })
201201
})
202202
})
203203

@@ -213,7 +213,7 @@ indent_size = 4
213213
[*.json]
214214
indent_size = unset
215215
`))
216-
matcher(path.join(__dirname, 'index.js')).should.match({ indent_size: 4 })
216+
matcher(path.join(__dirname, 'index.js')).should.include({ indent_size: 4 })
217217
matcher(path.join(__dirname, 'index.json')).should.be.eql({ })
218218
})
219219
})

0 commit comments

Comments
 (0)