Skip to content

Commit

Permalink
should.js is now deprecated. Switch to chai.
Browse files Browse the repository at this point in the history
  • Loading branch information
hildjj committed Jul 2, 2023
1 parent 6ec5744 commit b28cc90
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 78 deletions.
169 changes: 103 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -46,17 +46,18 @@
"semver": "^7.5.3"
},
"devDependencies": {
"@types/chai": "4.3.5",
"@types/mocha": "^10.0.1",
"@types/node": "^20.3.3",
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.60.1",
"c8": "8.0.0",
"chai": "4.3.7",
"eslint": "8.44.0",
"eslint-plugin-jsdoc": "46.4.3",
"mocha": "^10.2.0",
"rimraf": "^5.0.1",
"should": "^13.2.3",
"typescript": "^5.1.6"
},
"pnpm": {
Expand Down
11 changes: 5 additions & 6 deletions src/cli.test.ts
@@ -1,5 +1,4 @@
import 'should'

import 'chai/register-should.js'
import cli from './cli'
import type { Props } from './index'

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

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

it('Lists multiple files', async() => {
const res = await exec('foo.md', 'bar.js', '--files')
res.stdout.should.startWith('[foo.md]')
res.stdout.trim().should.endWith('.editorconfig [*]')
res.stdout.should.match(/^\[foo\.md\]/)
res.stdout.trim().should.match(/\.editorconfig \[\*\]$/)
})
})
10 changes: 5 additions & 5 deletions src/index.test.ts
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as fs from 'fs'
import * as path from 'path'
import 'should'
import 'chai/register-should.js'

import * as editorconfig from './'

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

it('caches', async () => {
Expand Down Expand Up @@ -196,8 +196,8 @@ indent_size = 4
[!(package).json]
indent_size = 3`))

matcher(path.join(__dirname, 'package.json')).should.match({ indent_size: 4 })
matcher(path.join(__dirname, 'foo.json')).should.match({ indent_size: 3 })
matcher(path.join(__dirname, 'package.json')).should.include({ indent_size: 4 })
matcher(path.join(__dirname, 'foo.json')).should.include({ indent_size: 3 })
})
})

Expand All @@ -213,7 +213,7 @@ indent_size = 4
[*.json]
indent_size = unset
`))
matcher(path.join(__dirname, 'index.js')).should.match({ indent_size: 4 })
matcher(path.join(__dirname, 'index.js')).should.include({ indent_size: 4 })
matcher(path.join(__dirname, 'index.json')).should.be.eql({ })
})
})

0 comments on commit b28cc90

Please sign in to comment.