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

chitchatsjs

v0.0.9

Published

Jest clone in JS with more strict types

Downloads

3

Readme

ChitChat

Jest clone with more strict types

Hi! Welcome to ChitChat! Or more professionally known as ChitChatsjs as the npm module! This is a jest clone with similar syntax, but with stricter types!

Installation

You can install ChitChat easily! Here is how:

npm i chitchatsjs

And in your js code:

var myvar = require('chitchatsjs')

Typescript is not currently supported.

Usage

After you've done all of that, you can get started with using ChitChat! Here is a quick tutorial!

Tutorial

Let's create a file called add.js, and in it put in the following code:

function add(num1, num2) {
  return num1 + num2
}
module.exports = add

After you've done that, in your package.json file lets add:

"scripts": {
  "test": "./chitchatsjs build tests/mytest.js && node tests/mytest.js"
},

Now, lets create a folder called tests, and add a file called mytest.js in it. In it put the following code:

var add = require('../add.js')
TestCase('First Test', add(1, 5), () => {
  return test.expectToBeNum(6)
});

Then, run npm run test, and you should see it build your file and a test prompt come up saying:

✅  First Test Passed!

That's it for this tutorial! While our little function is tiny and simple, yours can be super big and complex! If you have any problems, please contact us in out github repo or in a comment!

Future

We have more things coming soon! Like:

expectToThrowError()

Wrong Expection & Errors

Of course, when you are expecting return values, your going to get one wrong eventually, lets use this example wrong expection:

function add(num1, num2) {
  return num1 + num2
}
TestCase("Example Test", add(2, 2), () => {
  test.expectToBeNum(5)
});

Of course, 4 is not 5, so our expection is wrong. But, what will it return? This is what it will return if you run it:

❌  Example Test failed.
Expected number:
   5
but received number:
   4

There will be color in the terminal/console

So, the number we expected was 5, which you can see in our code on line 6 of our example. But add(2, 2) would return the value of four, which is the number that the test case received from the function and would succeed if we expected it. There are also errors if you don't follow types correctly.

Errors

This is when chitchat will throw an error that will end your tests because of an error that would cause more errors that would be hard to fix. These error include

  • Incorrect types to expection, like: expectToBeNum('Hello')
  • Fields in TestCase and expection not filled out.

Contributing!

I won't except contributers, cause this is me learning js, but if I know you, and want you on the project, maybe you'll be invited!

But if you have your heart set on contributing, you can leave suggestions in this github repo!

Credits

  • My Brain, for punching me in the stomach until I did this
  • @darkdarcool(myself), for doing this
  • @RayhanADev, for helping me with the function in the TestCase function

Conclusion

Thanks for reading this. If you wanna use this, go ahead. This does not replace jest. I worked hard on this and hope you try it out.

KTHXBAI!!

Pssst, if you wanna look at the source code, go here