diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100755 index 610c2a5..0000000 --- a/.husky/pre-push +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npm test diff --git a/package.json b/package.json index 8228fb8..e590751 100644 --- a/package.json +++ b/package.json @@ -30,15 +30,12 @@ "build:1-declaration": "tsc -p declaration.tsconfig.json", "build:2-schema-file": "echo \"console.log(JSON.stringify(require('.').socketYmlSchema, undefined, 2))\" | node > schema.json", "build": "run-s build:*", - "check:dependency-check": "dependency-check '*.js' 'test/**/*.js' --no-dev", - "check:installed-check": "installed-check -i eslint-plugin-jsdoc", "check:lint": "eslint --report-unused-disable-directives .", "check:tsc": "tsc", "check:type-coverage": "type-coverage --detail --strict --at-least 95 --ignore-files 'test/*'", "check": "run-p -c --aggregate-output check:*", "clean:declarations": "rm -rf $(find . -maxdepth 2 -type f -name '*.d.ts*')", "clean": "run-p clean:*", - "prepare": "husky install", "prepublishOnly": "git push --follow-tags && gh-release -y && run-s build", "test:mocha": "c8 --reporter=lcov --reporter text mocha 'test/**/*.spec.js'", "test-ci": "run-s test:*", @@ -48,20 +45,17 @@ "version:git": "git add CHANGELOG.md" }, "devDependencies": { - "@tsconfig/node14": "^14.1.3", - "@types/chai": "^4.3.3", - "@types/chai-as-promised": "^7.1.5", + "@tsconfig/node22": "^22.0.1", + "@types/chai": "^5.2.2", + "@types/chai-as-promised": "^8.0.2", "@types/mocha": "^10.0.0", - "@types/node": "^14.18.36", + "@types/node": "^22.15.19", "c8": "^10.1.3", - "chai": "^4.3.6", + "chai": "^5.2.0", "chai-as-promised": "^8.0.1", - "dependency-check": "^5.0.0-7", - "husky": "^8.0.3", - "installed-check": "^9.3.0", - "mocha": "^10.0.0", + "mocha": "^11.4.0", "neostandard": "^0.12.0", - "npm-run-all2": "^6.0.2", + "npm-run-all2": "^8.0.2", "type-coverage": "^2.24.1", "typescript": "~5.8.3", "auto-changelog": "^2.4.0", diff --git a/test/parse.spec.js b/test/parse.spec.js index c52222b..b1dc6b9 100644 --- a/test/parse.spec.js +++ b/test/parse.spec.js @@ -4,6 +4,7 @@ const { readFile } = require('node:fs/promises') const path = require('node:path') const chai = require('chai') +const { expect } = chai const { default: chaiAsPromised } = require('chai-as-promised') const { @@ -13,7 +14,6 @@ const { } = require('../index.js') chai.use(chaiAsPromised) -const should = chai.should() /** @type {import('../index.js').SocketYml} */ const defaults = { @@ -27,7 +27,7 @@ describe('parseSocketConfig()', () => { it('should read and parse socket.yml', async () => { const fileContent = await readFile(path.resolve(__dirname, 'sample.yml'), 'utf8') - parseSocketConfig(fileContent).should.deep.equal({ + expect(parseSocketConfig(fileContent)).to.deep.equal({ githubApp: { enabled: true, projectReportsEnabled: true, @@ -47,60 +47,59 @@ describe('parseSocketConfig()', () => { it('should read and parse socket.yml v1', async () => { const fileContent = await readFile(path.resolve(__dirname, 'sample-v1.yml'), 'utf8') - parseSocketConfig(fileContent).should.deep.equal({ + expect(parseSocketConfig(fileContent)).to.deep.equal({ githubApp: { enabled: true, projectReportsEnabled: false, pullRequestAlertsEnabled: true, }, issueRules: {}, - projectIgnorePaths: [ - 'foo', - 'bar', - ], + projectIgnorePaths: ['foo', 'bar'], version: 2, }) }) it('should throw on invalid document structure', () => { - should.Throw(() => { + expect(() => { parseSocketConfig(` projectIgnorePaths: true `) - }, SocketValidationError, /Invalid config definition/) + }).to.throw(SocketValidationError, /Invalid config definition/) }) it('should throw error when not parseable', () => { - should.Throw(() => { + expect(() => { parseSocketConfig(` foo: abc, {{ bcd }} {{ cde }} bar: {{ def }} {{ efg }} `) - }, /Error when parsing socket\.yml config/) + }).to.throw(/Error when parsing socket\.yml config/) }) it('should not return unknown properties', () => { - parseSocketConfig(` + expect( + parseSocketConfig(` version: 2 foo: true `) - .should.deep.equal(defaults) + ).to.deep.equal(defaults) }) it('should coerce types', () => { - parseSocketConfig(` + expect( + parseSocketConfig(` version: 2 projectIgnorePaths: foobar `) - .should.deep.equal({ - ...defaults, - projectIgnorePaths: ['foobar'], - }) + ).to.deep.equal({ + ...defaults, + projectIgnorePaths: ['foobar'], + }) }) }) describe('getDefaultConfig()', () => { it('should return a default config', () => { - getDefaultConfig().should.deep.equal(defaults) + expect(getDefaultConfig()).to.deep.equal(defaults) }) }) diff --git a/test/read.spec.js b/test/read.spec.js index 301d15c..840b343 100644 --- a/test/read.spec.js +++ b/test/read.spec.js @@ -3,6 +3,7 @@ const path = require('node:path') const chai = require('chai') +const { expect } = chai const { default: chaiAsPromised } = require('chai-as-promised') const { @@ -10,11 +11,12 @@ const { } = require('../index.js') chai.use(chaiAsPromised) -chai.should() describe('readSocketConfig()', () => { it('should read and parse socket.yml', async () => { - await readSocketConfig(path.resolve(__dirname, 'sample.yml')).should.eventually.become({ + await expect( + readSocketConfig(path.resolve(__dirname, 'sample.yml')) + ).to.eventually.deep.equal({ githubApp: { enabled: true, projectReportsEnabled: true, @@ -32,12 +34,14 @@ describe('readSocketConfig()', () => { }) it('should fail silently when file not found', async () => { - await readSocketConfig(path.resolve(__dirname, 'non-existing.yml')) - .should.eventually.become(undefined) + await expect( + readSocketConfig(path.resolve(__dirname, 'non-existing.yml')) + ).to.eventually.equal(undefined) }) it('should throw error when given a non-file', async () => { - await readSocketConfig(__dirname) - .should.be.rejectedWith(/Error when reading socket\.yml config file/) + await expect( + readSocketConfig(__dirname) + ).to.be.rejectedWith(/Error when reading socket\.yml config file/) }) }) diff --git a/tsconfig.json b/tsconfig.json index a307f0e..026ebc1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { - "extends": "@tsconfig/node14/tsconfig.json", + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@tsconfig/node22/tsconfig.json", "files": [ "index.js" ],