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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@e280/science

v0.1.4

Published

ts/js testing library

Readme

🧪 @e280/science

  • minimalist ts/js testing framework
  • deadass simple, no cli actually
  • no funky instrumentation horseshit
  • zero dependencies
  • an https://e280.org/ project

Easy setup

  • install science
    npm install --save-dev @e280/science
  • create your tests.test.js
    import {Science, suite, test, expect} from "@e280/science"
    
    await Science.run({
      "addition works": test(async() => {
        expect(2 + 2).is(4)
      }),
    })
  • run your tests in node
    node tests.test.js
  • watch mode (run-on-save!)
    node --watch tests.test.js
  • run the debugger
    node inspect tests.test.js
  • stick it in your package.json
    "scripts": {
      "test": "node tests.test.js",
      "test-watch": "node --watch tests.test.js"
    },

Learn by example

Happy tests

// example test case
"addition works": test(async() => {
  expect(2 + 2).is(4)
}),

Skipping tests

  //            skip this test
  //                   👇
"addition works": test.skip(async() => {
  expect(2 + 2).is(4)
}),

Only running some tests

  //            only run this test
  //                   👇
"addition works": test.only(async() => {
  expect(2 + 2).is(4)
}),

Failing tests

"addition works": test(async() => {

  // fail by expectation
  expect(2 + 2).is(5)

  // fail by returning false
  return false

  // fail by throwing a string or error
  throw "universe is broken"
}),

Arbitrary nesting of test suites

await Science.run({
  "nesting": suite({
    "deeper nesting": suite({
      "addition works": test(async() => {
        expect(2 + 2).is(4)
      }),
    }),
  }),
})
  • suite.skip works
  • suite.only works

Passing in options

  • the options object passed in via javascript gets top priority
    await Science.run(myTestSuite, {
    
      // print all test cases
      verbose: true,
    
      // disable colors and emojis
      theme: Science.themes.plain,
    })
  • the next fallback are cli arguments
    node tests.test.js --verbose --theme=seaside
  • (best practice) the next fallback are environment vars
    SCIENCE_VERBOSE=1 SCIENCE_THEME=seaside node tests.test.js
    • using environment variables is preferable to hard-coding anything
    • this allows developers to choose their own preference
    • they can simply run export SCIENCE_VERBOSE=1 or export SCIENCE_THEME=seaside in their terminal before starting a science watch routine

Available themes

  • redgreen (default) errors are red, happy tests are green
  • seaside better for color blindness, errors are red, happy tests are blue
  • plain no colors, no emojis

The key to happiness is realistic expectations

see all the expectations in expectations.ts

const x = 2 + 2

expect(x).is(4)

// custom fail note
expect(x, "universe is broken").is(2)

// custom fail note (alt syntax)
expect(x)
  .note("universe is broken")
  .is(2)

expect(x).isnt(4)
expect(x).gt(3)
expect(x).lt(5)
expect(x).gte(4)
expect(x).lte(4)

expect(x).happy() // not undefined or null
expect(x).sad() // undefined or null

expect(() => {throw "lol"}).throws()
await expect(async() => {throw "lol"}).throwsAsync()

// you can ".not" anything
expect(x).not.is(5)
expect(x).not.isnt(4) // lol
expect(() => {throw "lol"}).not.throws()

💖 Made with open source love

build with us at https://e280.org/ but only if you're cool