Skip to content

Commit d3979ba

Browse files
authored
Merge pull request #46 from SocketDev/deps
2 parents b183c92 + 6397817 commit d3979ba

File tree

5 files changed

+37
-43
lines changed

5 files changed

+37
-43
lines changed

.husky/pre-push

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@
3030
"build:1-declaration": "tsc -p declaration.tsconfig.json",
3131
"build:2-schema-file": "echo \"console.log(JSON.stringify(require('.').socketYmlSchema, undefined, 2))\" | node > schema.json",
3232
"build": "run-s build:*",
33-
"check:dependency-check": "dependency-check '*.js' 'test/**/*.js' --no-dev",
34-
"check:installed-check": "installed-check -i eslint-plugin-jsdoc",
3533
"check:lint": "eslint --report-unused-disable-directives .",
3634
"check:tsc": "tsc",
3735
"check:type-coverage": "type-coverage --detail --strict --at-least 95 --ignore-files 'test/*'",
3836
"check": "run-p -c --aggregate-output check:*",
3937
"clean:declarations": "rm -rf $(find . -maxdepth 2 -type f -name '*.d.ts*')",
4038
"clean": "run-p clean:*",
41-
"prepare": "husky install",
4239
"prepublishOnly": "git push --follow-tags && gh-release -y && run-s build",
4340
"test:mocha": "c8 --reporter=lcov --reporter text mocha 'test/**/*.spec.js'",
4441
"test-ci": "run-s test:*",
@@ -48,20 +45,17 @@
4845
"version:git": "git add CHANGELOG.md"
4946
},
5047
"devDependencies": {
51-
"@tsconfig/node14": "^14.1.3",
52-
"@types/chai": "^4.3.3",
53-
"@types/chai-as-promised": "^7.1.5",
48+
"@tsconfig/node22": "^22.0.1",
49+
"@types/chai": "^5.2.2",
50+
"@types/chai-as-promised": "^8.0.2",
5451
"@types/mocha": "^10.0.0",
55-
"@types/node": "^14.18.36",
52+
"@types/node": "^22.15.19",
5653
"c8": "^10.1.3",
57-
"chai": "^4.3.6",
54+
"chai": "^5.2.0",
5855
"chai-as-promised": "^8.0.1",
59-
"dependency-check": "^5.0.0-7",
60-
"husky": "^8.0.3",
61-
"installed-check": "^9.3.0",
62-
"mocha": "^10.0.0",
56+
"mocha": "^11.4.0",
6357
"neostandard": "^0.12.0",
64-
"npm-run-all2": "^6.0.2",
58+
"npm-run-all2": "^8.0.2",
6559
"type-coverage": "^2.24.1",
6660
"typescript": "~5.8.3",
6761
"auto-changelog": "^2.4.0",

test/parse.spec.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { readFile } = require('node:fs/promises')
44
const path = require('node:path')
55

66
const chai = require('chai')
7+
const { expect } = chai
78
const { default: chaiAsPromised } = require('chai-as-promised')
89

910
const {
@@ -13,7 +14,6 @@ const {
1314
} = require('../index.js')
1415

1516
chai.use(chaiAsPromised)
16-
const should = chai.should()
1717

1818
/** @type {import('../index.js').SocketYml} */
1919
const defaults = {
@@ -27,7 +27,7 @@ describe('parseSocketConfig()', () => {
2727
it('should read and parse socket.yml', async () => {
2828
const fileContent = await readFile(path.resolve(__dirname, 'sample.yml'), 'utf8')
2929

30-
parseSocketConfig(fileContent).should.deep.equal({
30+
expect(parseSocketConfig(fileContent)).to.deep.equal({
3131
githubApp: {
3232
enabled: true,
3333
projectReportsEnabled: true,
@@ -47,60 +47,59 @@ describe('parseSocketConfig()', () => {
4747
it('should read and parse socket.yml v1', async () => {
4848
const fileContent = await readFile(path.resolve(__dirname, 'sample-v1.yml'), 'utf8')
4949

50-
parseSocketConfig(fileContent).should.deep.equal({
50+
expect(parseSocketConfig(fileContent)).to.deep.equal({
5151
githubApp: {
5252
enabled: true,
5353
projectReportsEnabled: false,
5454
pullRequestAlertsEnabled: true,
5555
},
5656
issueRules: {},
57-
projectIgnorePaths: [
58-
'foo',
59-
'bar',
60-
],
57+
projectIgnorePaths: ['foo', 'bar'],
6158
version: 2,
6259
})
6360
})
6461

6562
it('should throw on invalid document structure', () => {
66-
should.Throw(() => {
63+
expect(() => {
6764
parseSocketConfig(`
6865
projectIgnorePaths: true
6966
`)
70-
}, SocketValidationError, /Invalid config definition/)
67+
}).to.throw(SocketValidationError, /Invalid config definition/)
7168
})
7269

7370
it('should throw error when not parseable', () => {
74-
should.Throw(() => {
71+
expect(() => {
7572
parseSocketConfig(`
7673
foo: abc, {{ bcd }} {{ cde }}
7774
bar: {{ def }} {{ efg }}
7875
`)
79-
}, /Error when parsing socket\.yml config/)
76+
}).to.throw(/Error when parsing socket\.yml config/)
8077
})
8178

8279
it('should not return unknown properties', () => {
83-
parseSocketConfig(`
80+
expect(
81+
parseSocketConfig(`
8482
version: 2
8583
foo: true
8684
`)
87-
.should.deep.equal(defaults)
85+
).to.deep.equal(defaults)
8886
})
8987

9088
it('should coerce types', () => {
91-
parseSocketConfig(`
89+
expect(
90+
parseSocketConfig(`
9291
version: 2
9392
projectIgnorePaths: foobar
9493
`)
95-
.should.deep.equal({
96-
...defaults,
97-
projectIgnorePaths: ['foobar'],
98-
})
94+
).to.deep.equal({
95+
...defaults,
96+
projectIgnorePaths: ['foobar'],
97+
})
9998
})
10099
})
101100

102101
describe('getDefaultConfig()', () => {
103102
it('should return a default config', () => {
104-
getDefaultConfig().should.deep.equal(defaults)
103+
expect(getDefaultConfig()).to.deep.equal(defaults)
105104
})
106105
})

test/read.spec.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
const path = require('node:path')
44

55
const chai = require('chai')
6+
const { expect } = chai
67
const { default: chaiAsPromised } = require('chai-as-promised')
78

89
const {
910
readSocketConfig
1011
} = require('../index.js')
1112

1213
chai.use(chaiAsPromised)
13-
chai.should()
1414

1515
describe('readSocketConfig()', () => {
1616
it('should read and parse socket.yml', async () => {
17-
await readSocketConfig(path.resolve(__dirname, 'sample.yml')).should.eventually.become({
17+
await expect(
18+
readSocketConfig(path.resolve(__dirname, 'sample.yml'))
19+
).to.eventually.deep.equal({
1820
githubApp: {
1921
enabled: true,
2022
projectReportsEnabled: true,
@@ -32,12 +34,14 @@ describe('readSocketConfig()', () => {
3234
})
3335

3436
it('should fail silently when file not found', async () => {
35-
await readSocketConfig(path.resolve(__dirname, 'non-existing.yml'))
36-
.should.eventually.become(undefined)
37+
await expect(
38+
readSocketConfig(path.resolve(__dirname, 'non-existing.yml'))
39+
).to.eventually.equal(undefined)
3740
})
3841

3942
it('should throw error when given a non-file', async () => {
40-
await readSocketConfig(__dirname)
41-
.should.be.rejectedWith(/Error when reading socket\.yml config file/)
43+
await expect(
44+
readSocketConfig(__dirname)
45+
).to.be.rejectedWith(/Error when reading socket\.yml config file/)
4246
})
4347
})

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"extends": "@tsconfig/node14/tsconfig.json",
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "@tsconfig/node22/tsconfig.json",
34
"files": [
45
"index.js"
56
],

0 commit comments

Comments
 (0)