diff --git a/.github/workflows/node-aught.yml b/.github/workflows/node-aught.yml index f3cddd85..8cd2141b 100644 --- a/.github/workflows/node-aught.yml +++ b/.github/workflows/node-aught.yml @@ -9,6 +9,7 @@ jobs: range: '< 10' type: minors command: npm run tests-only + subpackage: ./lib node: name: 'node < 10' diff --git a/.github/workflows/node-pretest.yml b/.github/workflows/node-pretest.yml index 72bdfa3a..bea9a823 100644 --- a/.github/workflows/node-pretest.yml +++ b/.github/workflows/node-pretest.yml @@ -6,4 +6,19 @@ jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main with: - skip-engines: true # bin/tape requires node 8+, but the rest of tape supports 0.4+ + skip-engines: true # bin/tape requires node 8+, but tape-lib supports 0.4+. TODO: fix and add engines.node in v6 + + engines-lib: + runs-on: ubuntu-latest + steps: + - uses: ljharb/actions/node/engines@main + with: + working-directory: lib + + pack-lib: + runs-on: ubuntu-latest + steps: + - uses: ljharb/actions/node/pack@main + with: + after_install: cd ../ && npm install + working-directory: lib diff --git a/.github/workflows/node-tens.yml b/.github/workflows/node-tens.yml index b49ceb1f..f516661a 100644 --- a/.github/workflows/node-tens.yml +++ b/.github/workflows/node-tens.yml @@ -9,6 +9,7 @@ jobs: range: '>= 10' type: minors command: npm run tests-only + subpackage: ./lib node: name: 'node >= 10' diff --git a/.gitignore b/.gitignore index a63afe6d..6a2f2f8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # gitignore /node_modules +**/node_modules # Only apps should have lockfiles yarn.lock diff --git a/bin/tape b/bin/tape index 3b41be76..47e16f67 100755 --- a/bin/tape +++ b/bin/tape @@ -79,7 +79,7 @@ var files = opts._.reduce(function (result, arg) { var hasImport = require('has-dynamic-import'); -var tape = require('../'); +var tape = require('tape-lib'); function importFiles(hasSupport) { if (!hasSupport) { diff --git a/index.js b/index.js index 288ce9a8..ea90786e 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = require('./lib'); +module.exports = require('tape-lib'); diff --git a/lib/.npmrc b/lib/.npmrc new file mode 100644 index 00000000..eacea13e --- /dev/null +++ b/lib/.npmrc @@ -0,0 +1,3 @@ +package-lock=false +allow-same-version=true +message=v%s diff --git a/lib/package.json b/lib/package.json new file mode 100644 index 00000000..c64962a1 --- /dev/null +++ b/lib/package.json @@ -0,0 +1,71 @@ +{ + "name": "tape-lib", + "version": "0.0.0", + "description": "TAP-producing test harness library for node and browsers", + "main": "index.js", + "browser": { + "fs": false + }, + "exports": { + ".": "./index.js", + "./default_stream": "./default_stream.js", + "./results": "./results.js", + "./test": "./test.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated --gitignore=../.gitignore", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "tests-only": "cd ../ && npm run tests-only", + "test": "cd ../ && npm test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/tape.git", + "directory": "lib" + }, + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/tape/issues" + }, + "homepage": "https://github.com/ljharb/tape/#readme", + "keywords": [ + "tap", + "test", + "harness", + "assert", + "browser" + ], + "dependencies": { + "@ljharb/resumer": "^0.0.1", + "@ljharb/through": "^2.3.11", + "array.prototype.every": "^1.1.5", + "call-bind": "^1.0.5", + "deep-equal": "^2.2.3", + "defined": "^1.0.1", + "for-each": "^0.3.3", + "hasown": "^2.0.0", + "inherits": "^2.0.4", + "is-regex": "^1.1.4", + "mock-property": "^1.0.3", + "object-inspect": "^1.13.1", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "string.prototype.trim": "^1.2.8" + }, + "engines": { + "node": ">= 0.4" + }, + "publishConfig": { + "ignore": [] + }, + "devDependencies": { + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "safe-publish-latest": "^2.0.0" + } +} diff --git a/node_modules/tape-lib b/node_modules/tape-lib new file mode 120000 index 00000000..dc598c56 --- /dev/null +++ b/node_modules/tape-lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/package.json b/package.json index 0aca5f05..e8af5f3f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tape", "version": "5.7.2", - "description": "tap-producing test harness for node and browsers", + "description": "TAP-producing test harness for node and browsers", "main": "index.js", "browser": { "fs": false @@ -19,32 +19,23 @@ "example": "example", "test": "test" }, + "bundledDependencies": [ + "tape-lib" + ], "dependencies": { - "@ljharb/resumer": "^0.0.1", - "@ljharb/through": "^2.3.11", - "array.prototype.every": "^1.1.5", - "call-bind": "^1.0.5", - "deep-equal": "^2.2.3", - "defined": "^1.0.1", "dotignore": "^0.1.2", "for-each": "^0.3.3", "get-package-type": "^0.1.0", "glob": "^7.2.3", "has-dynamic-import": "^2.0.1", - "hasown": "^2.0.0", - "inherits": "^2.0.4", - "is-regex": "^1.1.4", "minimist": "^1.2.8", - "mock-property": "^1.0.3", - "object-inspect": "^1.13.1", - "object-is": "^1.1.5", "object-keys": "^1.1.1", "object.assign": "^4.1.4", - "resolve": "^2.0.0-next.5", - "string.prototype.trim": "^1.2.8" + "resolve": "^2.0.0-next.5" }, "devDependencies": { "@ljharb/eslint-config": "^21.1.0", + "@ljharb/through": "^2.3.11", "array.prototype.flatmap": "^1.3.2", "aud": "^2.0.3", "auto-changelog": "^2.4.0", @@ -54,11 +45,12 @@ "es-value-fixtures": "^1.4.2", "eslint": "=8.8.0", "falafel": "^2.2.5", - "intl-fallback-symbol": "^1.0.0", + "in-publish": "^2.0.1", "jackspeak": "=2.1.1", "js-yaml": "^3.14.0", "npm-run-posix-or-windows": "^2.0.2", "npmignore": "^0.3.0", + "object-inspect": "^1.13.1", "safe-publish-latest": "^2.0.0", "tap": "^8.0.1", "tap-parser": "^5.4.0" @@ -119,7 +111,10 @@ }, "publishConfig": { "ignore": [ - ".github/workflows" + ".github/workflows", + "lib/*", + "!lib/{default_stream,results,test}.js", + "**/node_modules" ] } } diff --git a/test/common.js b/test/common.js index f2098225..071c6f61 100644 --- a/test/common.js +++ b/test/common.js @@ -42,7 +42,8 @@ var stripChangingData = function (line) { var withoutTestDir = line.replace(__dirname, '$TEST'); var withoutPackageDir = withoutTestDir.replace(path.dirname(__dirname), '$TAPE'); var withoutPathSep = withoutPackageDir.replace(new RegExp('\\' + path.sep, 'g'), '/'); - var withoutLineNumbers = withoutPathSep.replace(/:\d+:\d+/g, ':$LINE:$COL'); + var withoutLibDir = withoutPathSep.replace('$TAPE/node_modules/tape-lib/', '$TAPE/lib/'); + var withoutLineNumbers = withoutLibDir.replace(/:\d+:\d+/g, ':$LINE:$COL'); var withoutNestedLineNumbers = withoutLineNumbers.replace(/, :\$LINE:\$COL\)$/, ')'); return withoutNestedLineNumbers; };