From 1e3e97a57335b8b5a1066a1c240ccb3309f2449c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 1 Dec 2020 20:37:26 +0200 Subject: [PATCH 1/5] feature(package) madrun v8.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 453e9e4..b44ab9b 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "eslint": "^7.0.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-putout": "^4.0.2", - "madrun": "^6.0.1", + "madrun": "^8.0.0", "mock-require": "^3.0.2", "nodemon": "^2.0.2", "nyc": "^15.0.1", From 98719c07fec8d8c60240306feb30587b16ab8fc6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 1 Dec 2020 20:37:30 +0200 Subject: [PATCH 2/5] feature(package) putout v11.12.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b44ab9b..08b65d1 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "mock-require": "^3.0.2", "nodemon": "^2.0.2", "nyc": "^15.0.1", - "putout": "^8.2.0" + "putout": "^11.12.1" }, "license": "MIT", "engines": { From 6b52db738a0afe7156e873f4ba29698c2712264a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 1 Dec 2020 20:37:39 +0200 Subject: [PATCH 3/5] feature(package) eslint-plugin-putout v6.8.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08b65d1..08ab75f 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "coveralls": "^3.0.0", "eslint": "^7.0.0", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-putout": "^4.0.2", + "eslint-plugin-putout": "^6.8.1", "madrun": "^8.0.0", "mock-require": "^3.0.2", "nodemon": "^2.0.2", From ef05735a24a0a3d62a001dd3f62b5ffb3bd65975 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 1 Dec 2020 21:15:18 +0200 Subject: [PATCH 4/5] feature(supertape) drop support of node < 14 --- .eslintrc.json | 18 +++++++++++++----- .gitignore | 2 +- .madrun.js | 13 ------------- .madrun.mjs | 11 +++++++++++ .putout.json | 3 +++ .travis.yml | 16 ++++++---------- README.md | 22 ++++++++++------------ bin/{supertape.js => supertape.mjs} | 29 +++++++++++++++++------------ lib/super-import.js | 22 ---------------------- lib/supertape.js | 2 +- package.json | 7 ++++--- 11 files changed, 66 insertions(+), 79 deletions(-) delete mode 100644 .madrun.js create mode 100644 .madrun.mjs rename bin/{supertape.js => supertape.mjs} (68%) delete mode 100644 lib/super-import.js diff --git a/.eslintrc.json b/.eslintrc.json index 69f1fd5..b35fb91 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,17 +1,25 @@ { - "parser": "babel-eslint", + "parser": "@babel/eslint-parser", + "parserOptions": { + "requireConfigFile": false + }, "overrides": [{ - "files": ["bin/*.js"], + "files": "bin/*.js", "rules": { "no-process-exit": "off" } + }, { + "files": "*.md{js}", + "rules": { + "no-unreachable": "off" + } }], "rules": { - "node/no-unsupported-features/es-syntax": "off" + "node/no-unsupported-features/es-syntax": "off" }, "extends": [ - "plugin:putout/recommended", - "plugin:node/recommended" + "plugin:node/recommended", + "plugin:putout/recommended" ], "plugins": [ "node", diff --git a/.gitignore b/.gitignore index 3f508dd..87d78c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ node_modules .nyc_output -legacy yarn-error.log .*.swp +.putoutcache diff --git a/.madrun.js b/.madrun.js deleted file mode 100644 index 2a937de..0000000 --- a/.madrun.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -const {run} = require('madrun'); - -module.exports = { - 'test': () => 'node bin/supertape \'test/*.js\'', - 'watch:test': () => 'nodemon -w lib -w test -x "npm test"', - 'lint': () => 'putout bin lib test .madrun.js', - 'fix:lint': () => run('lint', '--fix'), - 'coverage': () => 'nyc npm test', - 'report': () => 'nyc report --reporter=text-lcov | coveralls', -}; - diff --git a/.madrun.mjs b/.madrun.mjs new file mode 100644 index 0000000..4735b1e --- /dev/null +++ b/.madrun.mjs @@ -0,0 +1,11 @@ +import {run} from 'madrun'; + +export default { + 'test': () => `node bin/supertape.mjs 'test/*.js'`, + 'watch:test': async () => `nodemon -w lib -w test -x "${await run('test')}"`, + 'lint': () => 'putout .', + 'fix:lint': () => run('lint', '--fix'), + 'coverage': () => 'nyc npm test', + 'report': () => 'nyc report --reporter=text-lcov | coveralls', +}; + diff --git a/.putout.json b/.putout.json index a665c0d..d4d72bf 100644 --- a/.putout.json +++ b/.putout.json @@ -1,5 +1,8 @@ { "match": { + "*.md": { + "remove-unreachable-code": "off" + }, "lib/supertape.js": { "remove-console": "off" }, diff --git a/.travis.yml b/.travis.yml index 2d3e9c4..0861471 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,13 @@ language: node_js node_js: - - 14 - - 12 - - 10 - + - 15 + - 14 script: - npm run lint - npm run coverage && npm run report - notifications: - email: - on_success: never - on_failure: change - + email: + on_success: never + on_failure: change sudo: false - +cache: false diff --git a/README.md b/README.md index 79623cc..995df45 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # Supertape [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL] -[NPMIMGURL]: https://img.shields.io/npm/v/supertape.svg?style=flat&longCache=true -[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/supertape/master.svg?style=flat&longCache=true -[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/supertape.svg?style=flat&longCache=true -[NPMURL]: https://npmjs.org/package/supertape "npm" -[BuildStatusURL]: https://travis-ci.org/coderaiser/supertape "Build Status" -[DependencyStatusURL]: https://david-dm.org/coderaiser/supertape "Dependency Status" - -[CoverageURL]: https://coveralls.io/github/coderaiser/supertape?branch=master -[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/supertape/badge.svg?branch=master&service=github +[NPMIMGURL]: https://img.shields.io/npm/v/supertape.svg?style=flat&longCache=true +[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/supertape/master.svg?style=flat&longCache=true +[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/supertape.svg?style=flat&longCache=true +[NPMURL]: https://npmjs.org/package/supertape "npm" +[BuildStatusURL]: https://travis-ci.org/coderaiser/supertape "Build Status" +[DependencyStatusURL]: https://david-dm.org/coderaiser/supertape "Dependency Status" +[CoverageURL]: https://coveralls.io/github/coderaiser/supertape?branch=master +[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/supertape/badge.svg?branch=master&service=github Tape with superpowers. Contains: @@ -41,7 +40,7 @@ test('lib: arguments', async (t) => { t.end(); }); -test('lib: diff', async (t) => { +test('lib: diff', (t) => { t.equal({}, {hello: 'world'}, 'should equal'); t.end(); }); @@ -55,7 +54,7 @@ test('lib: diff', async (t) => { + Object { + "hello": "world", + } -` +`; ``` ## Related @@ -66,4 +65,3 @@ test('lib: diff', async (t) => { ## License MIT - diff --git a/bin/supertape.js b/bin/supertape.mjs similarity index 68% rename from bin/supertape.js rename to bin/supertape.mjs index 0ecae0a..e1c3af5 100755 --- a/bin/supertape.js +++ b/bin/supertape.mjs @@ -2,16 +2,14 @@ 'use strict'; -const resolveModule = require('resolve').sync; -const resolvePath = require('path').resolve; -const {readFileSync} = require('fs'); +import {resolve as resolvePath} from 'path'; +import {readFileSync} from 'fs'; -const parseOpts = require('minimist'); -const glob = require('glob'); -const ignore = require('dotignore'); -const tryCatch = require('try-catch'); - -const superImport = require('../lib/super-import'); +import parseOpts from 'minimist'; +import glob from 'glob'; +import ignore from 'dotignore'; +import tryCatch from 'try-catch'; +import {createRequire} from 'module'; const {isArray} = Array; @@ -32,7 +30,10 @@ for (const module of opts.require) { /* This check ensures we ignore `-r ""`, trailing `-r`, or * other silly things the user might (inadvertently) be doing. */ - require(resolveModule(module, {basedir: cwd})); + const {resolve} = createRequire(import.meta.url); + await import(resolve(module, { + paths: [cwd], + })); } } @@ -58,8 +59,12 @@ for (const arg of opts._) { if (!isArray(files)) throw TypeError('unknown error: glob.sync did not return an array or throw. Please report this.'); - files.filter((file) => { return !matcher || !matcher.shouldIgnore(file); }).forEach(async (file) => { - await superImport(resolvePath(cwd, file)); + const list = files.filter((file) => { + return !matcher || !matcher.shouldIgnore(file); }); + + for (const file of list) { + await import(resolvePath(cwd, file)); + } } diff --git a/lib/super-import.js b/lib/super-import.js deleted file mode 100644 index e20b321..0000000 --- a/lib/super-import.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -const tryToCatch = require('try-to-catch'); - -module.exports = async (name) => { - const [e, result] = await tryToCatch(imp, name); - - if (!e) - return result; - - if (e.message === 'Not supported') - return require(name); - - throw e; -}; - -// that's right, `import` is reserved keyword -// and can not be passed to a function -async function imp(name) { - return await import(name); -} - diff --git a/lib/supertape.js b/lib/supertape.js index ea22bc8..48f11a9 100644 --- a/lib/supertape.js +++ b/lib/supertape.js @@ -16,7 +16,7 @@ const wrap = (test) => async (str, fn) => { }); }; -const getNewTape = () => { +const getNewTape = (tape) => { const newTape = wrap(tape); newTape.only = wrap(tape.only); diff --git a/package.json b/package.json index 08ab75f..f306341 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "type": "commonjs", "bin": { - "tape": "bin/supertape.js" + "tape": "bin/supertape.mjs" }, "nyc": { "exclude": [ @@ -55,8 +55,9 @@ "tape" ], "devDependencies": { + "@babel/core": "^7.12.9", + "@babel/eslint-parser": "^7.12.1", "@cloudcmd/stub": "^3.0.0", - "babel-eslint": "^10.1.0", "coveralls": "^3.0.0", "eslint": "^7.0.0", "eslint-plugin-node": "^11.1.0", @@ -69,7 +70,7 @@ }, "license": "MIT", "engines": { - "node": ">=10" + "node": ">=14" }, "publishConfig": { "access": "public" From 996a3ea7b75fe0e55d09615efc765801a9681fbd Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 1 Dec 2020 21:48:47 +0200 Subject: [PATCH 5/5] chore(package) v3.0.0 --- ChangeLog | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6b03cd7..f04f9e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2020.12.01, v3.0.0 + +feature: +- (supertape) drop support of node < 14 +- (package) eslint-plugin-putout v6.8.1 +- (package) putout v11.12.1 +- (package) madrun v8.0.0 + + 2020.05.10, v2.0.1 fix: diff --git a/package.json b/package.json index f306341..93444b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertape", - "version": "2.0.1", + "version": "3.0.0", "author": "coderaiser (https://github.com/coderaiser)", "description": "tape with superpowers", "homepage": "http://github.com/coderaiser/supertape",