From 4d73f75ec82553bfd164d2975d4b2e75dcac75d9 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Wed, 3 Apr 2024 17:47:01 -0400 Subject: [PATCH] packaging: npm configuration --- .gitignore | 1 + package-lock.json | 24 ++++++++++++++++++++++++ package.json | 34 ++++++++++++++++++++++++++++++++++ tests/01_tap.t.js | 29 +++++++---------------------- tests/suite.mjs | 4 ++-- 5 files changed, 68 insertions(+), 24 deletions(-) create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..34f78df --- /dev/null +++ b/package-lock.json @@ -0,0 +1,24 @@ +{ + "name": "test-tap", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "test-tap", + "version": "0.0.1", + "license": "Artistic-2.0", + "dependencies": { + "esm": "^3.2.25" + } + }, + "node_modules/esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "engines": { + "node": ">=6" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..ec59658 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "test-tap", + "version": "0.0.1", + "description": "Test-Tap a 0 dependency single file Test Anything Protocol library", + "type": "module", + "directories": { + "test": "tests", + "lib": "src" + }, + "files": [ + "src/*.mjs", + "src/*.js" + ], + "scripts": { + "test": "node tests/01_tap.t.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/zaphar/test-tap.git" + }, + "keywords": [ + "testing", + "tap" + ], + "author": "Jeremy Wall (jeremy@marzhillstudios.com)", + "license": "Artistic-2.0", + "bugs": { + "url": "https://github.com/zaphar/test-tap/issues" + }, + "homepage": "https://github.com/zaphar/test-tap#readme", + "dependencies": { + "esm": "^3.2.25" + } +} diff --git a/tests/01_tap.t.js b/tests/01_tap.t.js index 32573b4..ce42ba8 100644 --- a/tests/01_tap.t.js +++ b/tests/01_tap.t.js @@ -1,23 +1,8 @@ -/** @implements TapRenderer */ -class FakeRenderer { - output = "nothing yet"; - commentOutput = ""; - - out(text) { - this.output = text; - } +import { Tap, runTest } from '../src/Tap.mjs'; +import { tapSuite } from './suite.mjs'; - comment(lines) { - for (var line of lines) { - this.commentOutput += line; - } - } -} - -import('./suite.mjs').then(async m => { - const pair = m.Tap.Node(); - m.runTest(pair.Tap, "Tap dogfood test suite", m.tapSuite); - // Note output requires some async machinery because it uses some dynamic inputs. - await pair.Renderer.renderAll(); - process.exit(pair.Tap.isPass() ? 0 : 1); -}); +const pair = Tap.Node(); +runTest(pair.Tap, "Tap dogfood test suite", tapSuite); +// Note output requires some async machinery because it uses some dynamic inputs. +await pair.Renderer.renderAll(); +process.exit(pair.Tap.isPass() ? 0 : 1); diff --git a/tests/suite.mjs b/tests/suite.mjs index 1a48949..4773a1e 100644 --- a/tests/suite.mjs +++ b/tests/suite.mjs @@ -1,5 +1,5 @@ /** @implements TapRenderer */ -import {Tap, runTest, NodeRenderer, BrowserRenderer} from '../src/TAP.mjs'; +import { Tap } from '../src/Tap.mjs'; class FakeRenderer { output = "nothing yet"; @@ -159,4 +159,4 @@ function tapSuite(t) { return t; } -export { tapSuite, runTest, Tap }; +export { tapSuite };