chore: make tests work

This commit is contained in:
Rodney, Tiara 2025-04-25 19:19:40 +02:00
parent e4e21d4016
commit c4a98da88e
No known key found for this signature in database
GPG key ID: 5CD8EC1D46106723
6 changed files with 70 additions and 11 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ config.status
autom4te.cache autom4te.cache
/dist /dist
.DS_Store .DS_Store
/test-reports/

View file

@ -1,8 +1,8 @@
NPM=npm NPM=npm
.PHONY: configure chore package-lock.json publish dist .PHONY: configure chore package-lock.json publish dist test-reports
all: dist all: test-reports/ dist/
tags: tags:
ctags -R --exclude=node_modules --exclude=vendor --exclude=docs \ ctags -R --exclude=node_modules --exclude=vendor --exclude=docs \
@ -13,16 +13,16 @@ chore: configure package-lock.json
configure: configure:
autoconf autoconf
build/release/: node_modules/ src/ tsconfig.json build/release: node_modules/ src/ tsconfig.json
$(NPM) run build:release $(NPM) run build:release
build/debug/: node_modules/ src/ tsconfig.debug.json build/debug: node_modules/ src/ tsconfig.debug.json
$(NPM) run build:debug $(NPM) run build:debug
build/doc/: node_modules/ src/ typedoc.json tsconfig.json build/doc: node_modules/ src/ typedoc.json tsconfig.json
$(NPM) run doc $(NPM) run doc
test-reports/: node_modules/ tests/ src/ jest.config.mjs test-reports: node_modules/ tests/ src/ jest.config.mjs
$(NPM) run test $(NPM) run test
dist: build/release/ build/doc/ dist: build/release/ build/doc/

View file

@ -9,5 +9,15 @@ export default {
} }
] ]
}, },
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: 'test-reports',
outputName: 'junit-report.xml'
}
],
],
roots: ['./tests'] roots: ['./tests']
} }

47
package-lock.json generated
View file

@ -11,6 +11,7 @@
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-junit": "^16.0.0",
"ts-jest": "^29.3.2", "ts-jest": "^29.3.2",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typedoc": "^0.27.9", "typedoc": "^0.27.9",
@ -2604,6 +2605,22 @@
"fsevents": "^2.3.2" "fsevents": "^2.3.2"
} }
}, },
"node_modules/jest-junit": {
"version": "16.0.0",
"resolved": "http://localhost:4873/jest-junit/-/jest-junit-16.0.0.tgz",
"integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"mkdirp": "^1.0.4",
"strip-ansi": "^6.0.1",
"uuid": "^8.3.2",
"xml": "^1.0.1"
},
"engines": {
"node": ">=10.12.0"
}
},
"node_modules/jest-leak-detector": { "node_modules/jest-leak-detector": {
"version": "29.7.0", "version": "29.7.0",
"resolved": "http://localhost:4873/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", "resolved": "http://localhost:4873/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz",
@ -3196,6 +3213,19 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "http://localhost:4873/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true,
"license": "MIT",
"bin": {
"mkdirp": "bin/cmd.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "http://localhost:4873/ms/-/ms-2.1.3.tgz", "resolved": "http://localhost:4873/ms/-/ms-2.1.3.tgz",
@ -4052,6 +4082,16 @@
"browserslist": ">= 4.21.0" "browserslist": ">= 4.21.0"
} }
}, },
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "http://localhost:4873/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"dev": true,
"license": "MIT",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/v8-compile-cache-lib": { "node_modules/v8-compile-cache-lib": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "http://localhost:4873/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "resolved": "http://localhost:4873/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
@ -4139,6 +4179,13 @@
"node": "^12.13.0 || ^14.15.0 || >=16.0.0" "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
} }
}, },
"node_modules/xml": {
"version": "1.0.1",
"resolved": "http://localhost:4873/xml/-/xml-1.0.1.tgz",
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==",
"dev": true,
"license": "MIT"
},
"node_modules/y18n": { "node_modules/y18n": {
"version": "5.0.8", "version": "5.0.8",
"resolved": "http://localhost:4873/y18n/-/y18n-5.0.8.tgz", "resolved": "http://localhost:4873/y18n/-/y18n-5.0.8.tgz",

View file

@ -8,10 +8,8 @@
"build": "npm run build:release", "build": "npm run build:release",
"build:release": "tsc", "build:release": "tsc",
"build:debug": "tsc -p tsconfig.debug.json", "build:debug": "tsc -p tsconfig.debug.json",
"watch": "npm run watch:debug",
"watch:debug": "npm run build:debug -- --watch",
"doc": "typedoc --entryPoints src/index.ts --html build/doc", "doc": "typedoc --entryPoints src/index.ts --html build/doc",
"mypublish": "ts-node -P tsconfig.node.json scripts/publish.ts", "publish_": "ts-node -P tsconfig.node.json scripts/publish.ts",
"dist": "ts-node -P tsconfig.node.json scripts/npm-pack.ts build/release dist" "dist": "ts-node -P tsconfig.node.json scripts/npm-pack.ts build/release dist"
}, },
"repository": { "repository": {
@ -23,6 +21,7 @@
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-junit": "^16.0.0",
"ts-jest": "^29.3.2", "ts-jest": "^29.3.2",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typedoc": "^0.27.9", "typedoc": "^0.27.9",

View file

@ -10,7 +10,9 @@ describe('getLevelName', () => {
var logging: any; var logging: any;
beforeEach(() => { beforeEach(() => {
logging = require('../src/logging'); // there are a couple of singletons, which I'm not yet sure if they need
// to be reloaded for every test case
logging = require('../src');
}); });
it('numeric to textual representation of built-ins', () => { it('numeric to textual representation of built-ins', () => {
@ -73,7 +75,7 @@ describe('addLevelName', () => {
var logging: any; var logging: any;
beforeEach(() => { beforeEach(() => {
logging = require('../src/logging'); logging = require('../src');
}); });
it('numeric to textual representation of built-ins', () => { it('numeric to textual representation of built-ins', () => {