npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cuties/wall

v1.1.2

Published

Quality checker for projects for browser js and Node.js, can be integrated in build process of Page, also can be as stand alone application.

Downloads

43

Readme

wall

Wall is a tool that includes static analysis and test coverage. It was mainly made for Page and based on the Async Tree Pattern.

NPM Version Build Status codecov

Install

npm install @cuties/wall

Init eslint

node_modules/.bin/eslint --init

Test

npm test

Build

npm run build

Async objects

ExecutedLint

This async object represents the process where static analysis is executed.

new ExecutedLint(process, './src').call()

Async call: executedLint.

ExecutedTestCoverage

This async object represents the process where test coverage is executed.

new ExecutedTestCoverage(
  process, './test-executor.js'
).call()

File test-executor contains script that runs all your tests. You can use this library for doing such things.

Async call: executedTestCoverage.

ExecutedTestCoverageCheck

This async object represents the process where test coverage check is executed(after running tests via ExecutedTestCoverage). If coverage falls below a threshold (that can be configured via ConfiguredTestCoverage) the process fails. You can configure required test coverage percentages of lines, functions and branches via options in params.

new ExecutedTestCoverageCheck(
  new ExecutedTestCoverage(process, '/test-executor.js'),
  { lines: 100, functions: 100, branches: 100, 'statements': 100 }
).call()

Async call: executedTestCoverageCheck.

ExecutedTestCoverageReport

This async object represents the process where test coverage is reported (after running tests via ExecutedTestCoverage).

new ExecutedTestCoverageReport(
  new ExecutedTestCoverage(process, '/test-executor.js'), 'json-summary'
).call()

Async call: executedTestCoverageReport. About format(default value is text) of report you can read here.

Complete example

For making your project more qualitative use following composition:

const {
  ExecutedLint,
  ExecutedTestCoverage,
  ExecutedTestCoverageCheck,
  ExecutedTestCoverageReport
} = require('@cuties/wall')

new ExecutedLint(process, './src').after(
  new ExecutedTestCoverageCheck(
    new ExecutedTestCoverageReport(
      new ExecutedTestCoverage(
        process, './test-executor.js'
      ), 'json-summary'
    ), { lines: 100, functions: 100, branches: 100, statements: 100 }
  )
).call()

test-executor.js

const executor = require('test-executor');

executor('./test');

test-executor library

Log total coverage (LoggedTotalCoverageByJsonSummary)

If you use json-summary in ExecutedTestCoverageReport, then this async object generates report into coverage/coverage-summary.json file. And you can log to console total coverage numbers via LoggedTotalCoverageByJsonSummary, ReadDataByPath(cutie-fs) and ParsedJson(cutie-json):

const { ReadDataByPath } = require('@cuties/fs')
const { ParsedJSON } = require('@cuties/json')
const { ExecutedTestCoverage, ExecutedTestCoverageReport, LoggedTotalCoverageByJsonSummary } = require('./../index')

new ExecutedTestCoverageReport(
  new ExecutedTestCoverage(process, './test-executor.js'),
  'json-summary'
).after(
  new LoggedTotalCoverageByJsonSummary(
    new ParsedJSON(
      new ReadDataByPath('coverage/coverage-summary.json', { encoding: 'utf8' })
    ), (linesPct, statementsPct, functionsPct, branchesPct) => {
      return (linesPct + statementsPct + functionsPct + branchesPct) / 4
    }
  )
).call()

First argument of LoggedTotalCoverageByJsonSummary is json that contains coverage numbers(lines, statements, functions, branches percentages), second one is a function that calculates total number (in that case we just take average value of coverage numbers).

Output would look like:

Total coverage: 100%