Skip to content

Instantly share code, notes, and snippets.

@mdevils
Created March 15, 2021 18:34
Show Gist options
  • Save mdevils/0674355bc679e281d57c0cc167b344ce to your computer and use it in GitHub Desktop.
Save mdevils/0674355bc679e281d57c0cc167b344ce to your computer and use it in GitHub Desktop.
npm packages with tests included
const {execSync} = require('child_process');
process.chdir(__dirname);
execSync('npm install --no-save all-the-package-names', {stdio: 'ignore'});
const allThePackageNames = require('all-the-package-names');
const count = 100;
for (let i = 0; i < count; i++) {
const packageName = allThePackageNames[i];
execSync('rm -Rf tmp && mkdir -p tmp');
const info = JSON.parse(execSync(`npm show --json "${packageName}"`, {encoding: 'utf8'}));
const tarball = info.dist.tarball;
execSync(`cd tmp && wget "${tarball}" && tar xzf *`, {stdio: 'ignore'});
try {
const files = execSync(`cd tmp/package && find . | grep test`, {encoding: 'utf8'}).trim().split('\n');
console.log(`${packageName}: ${files.length}`);
console.log(files.map(fileName => ` ${fileName}`).join('\n'));
} catch (e) {
console.log(`${packageName}: none`);
}
}
mocha: 1 # false positive
./lib/test.js
chai: 1 # false positive
./lib/chai/utils/test.js
lodash: none
grunt: none
eslint: 3 # false positive
./lib/rule-tester
./lib/rule-tester/index.js
./lib/rule-tester/rule-tester.js
gulp: none
babel-preset-es2015: none
request: none
async: none
istanbul: 1 # false positive
./lib/command/test.js
should: none
express: none
babel-core: none
sinon: none
babel-cli: none
tape: 115 # match
./test
./test/double_end.js
# ...
grunt-contrib-jshint: none
underscore: none
coffee-script: none
webpack: none
babel-eslint: none
browserify: 529 # match
./test
./test/ignore_browser_field
./test/ignore_browser_field/main.js
# ...
chalk: none
commander: none
react: none
babel-loader: none
coveralls: none
rimraf: none
jshint: none
debug: none
bluebird: none
gulp-util: none
grunt-contrib-clean: none
grunt-contrib-watch: none
mkdirp: none
babel: none
karma: 1 # false positive
./scripts/integration-tests.sh
glob: none
colors: none
eslint-plugin-react: none
through2: none
gulp-rename: none
babel-preset-react: none
gulp-uglify: none
react-dom: 5 # false positive
./umd/react-dom-test-utils.production.min.js
./umd/react-dom-test-utils.development.js
./test-utils.js
./cjs/react-dom-test-utils.production.min.js
./cjs/react-dom-test-utils.development.js
grunt-contrib-uglify: none
moment: none
uglify-js: none
gulp-mocha: none
q: none
babel-preset-stage-0: none
standard: none
grunt-contrib-nodeunit: none
sinon-chai: none
jquery: none
yeoman-generator: none
babel-register: none
minimist: 16 # match, project is dead, PRs with "files" field to package.json are open
./test
./test/num.js
# ...
del: none
jshint-stylish: none
grunt-cli: none
fs-extra: none
body-parser: none
karma-chrome-launcher: 2 # match
./test
./test/jsflags.spec.js
ava: 2 # false positive
./lib/parse-test-args.js
./lib/test.js
karma-phantomjs-launcher: 2 # match
./test
./test/add.spec.js
webpack-dev-server: none
css-loader: none
eslint-config-airbnb: 5 # match
./test
./test/requires.js
# ...
yargs: none
load-grunt-tasks: none
expect.js: none
babel-runtime: none
cheerio: none
gulp-jshint: none
gulp-babel: none
eslint-plugin-import: none
supertest: 1 # false positive
./lib/test.js
style-loader: none
gulp-concat: none
gulp-eslint: none
grunt-mocha-test: 1 # false positive
./tasks/mocha-test.js
babel-polyfill: none
gulp-sourcemaps: none
grunt-contrib-concat: none
karma-jasmine: none
karma-mocha: none
grunt-contrib-copy: none
jsdom: none
gulp-plumber: none
optimist: 11 # match, project is dead
./test
./test/dash.js
# ...
tap: 189 # false positive
./node_modules/events-to-array/test
./node_modules/events-to-array/test/basic.js
# ...
babelify: none
babel-plugin-transform-runtime: none
semver: none
typescript: none
chai-as-promised: none
run-sequence: none
shelljs: 1 # false positive
./src/test.js
ember-cli: 56 # false positive (only helpers are included, not tests themselves)
./tests
./tests/helpers
./tests/helpers/acceptance.js
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment