diff --git a/.gitignore b/.gitignore index 6c9d7af..3ad7691 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ config.status autom4te.cache /dist .DS_Store +/test-reports/ diff --git a/Makefile b/Makefile index aa8737c..3284ab7 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ 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: ctags -R --exclude=node_modules --exclude=vendor --exclude=docs \ @@ -13,16 +13,16 @@ chore: configure package-lock.json configure: autoconf -build/release/: node_modules/ src/ tsconfig.json +build/release: node_modules/ src/ tsconfig.json $(NPM) run build:release -build/debug/: node_modules/ src/ tsconfig.debug.json +build/debug: node_modules/ src/ tsconfig.debug.json $(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 -test-reports/: node_modules/ tests/ src/ jest.config.mjs +test-reports: node_modules/ tests/ src/ jest.config.mjs $(NPM) run test dist: build/release/ build/doc/ diff --git a/jest.config.mjs b/jest.config.mjs index 0f08742..6590a36 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -9,5 +9,15 @@ export default { } ] }, + reporters: [ + 'default', + [ + 'jest-junit', + { + outputDirectory: 'test-reports', + outputName: 'junit-report.xml' + } + ], + ], roots: ['./tests'] } diff --git a/package-lock.json b/package-lock.json index 3d3ddcd..4ea535b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "devDependencies": { "@types/jest": "^29.5.14", "jest": "^29.7.0", + "jest-junit": "^16.0.0", "ts-jest": "^29.3.2", "ts-node": "^10.9.2", "typedoc": "^0.27.9", @@ -2604,6 +2605,22 @@ "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": { "version": "29.7.0", "resolved": "http://localhost:4873/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", @@ -3196,6 +3213,19 @@ "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": { "version": "2.1.3", "resolved": "http://localhost:4873/ms/-/ms-2.1.3.tgz", @@ -4052,6 +4082,16 @@ "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": { "version": "3.0.1", "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_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": { "version": "5.0.8", "resolved": "http://localhost:4873/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 75d7f9f..5bcf26d 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,8 @@ "build": "npm run build:release", "build:release": "tsc", "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", - "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" }, "repository": { @@ -23,6 +21,7 @@ "devDependencies": { "@types/jest": "^29.5.14", "jest": "^29.7.0", + "jest-junit": "^16.0.0", "ts-jest": "^29.3.2", "ts-node": "^10.9.2", "typedoc": "^0.27.9", diff --git a/tests/logging.test.ts b/tests/test.ts similarity index 91% rename from tests/logging.test.ts rename to tests/test.ts index a8ad3b7..208acdc 100644 --- a/tests/logging.test.ts +++ b/tests/test.ts @@ -10,7 +10,9 @@ describe('getLevelName', () => { var logging: any; 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', () => { @@ -73,7 +75,7 @@ describe('addLevelName', () => { var logging: any; beforeEach(() => { - logging = require('../src/logging'); + logging = require('../src'); }); it('numeric to textual representation of built-ins', () => {