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

kiwi-webpack-plugin

v0.0.20

Published

Test Runner for Webpack and the Kakoune editor

Downloads

6

Readme

Kiwi - Javascript Test Runner for Kakoune

Warning: This tool is under development. Breaking changes make occur anytime and some functionality might not be well tested. Do not rely on it for anything other than experiments.

Supports only Webpack 4 not 5

demo

Getting Started Guide

(if using the chrome runner) A recent Google Chrome browser should be installed

Version 12 or greater of NodeJS should be installed

The Kakoune Editor should be installed

Python and Virtualenv should be installed (only needed for review app)

# A new webpack app
mkdir app1
cd app1
mkdir src
npm init

# Install the plugin and related dependencies
npm i kiwi-webpack-plugin webpack@4 webpack-cli webpack-dev-server chai

create webpack.config.js

const KiwiPlugin = require('kiwi-webpack-plugin');

module.exports = {
    entry: './src/index.js',
    
    // target: 'node',    // use this if using the 'node' runner
    
    // Enable source maps
    devtool: 'source-map',
    
    plugins: [
        new KiwiPlugin({
        	testEntry: './src/tests.js',
        	// Run the chrome browser instance in headless mode (in background without window)
        	headless: true,
        	// when building once (not watching) do process.exit(1)
        	// if any tests failed
        	stopBuildOnFail: true,
        	runner: 'chrome', // can also be 'node'
    	}),
    ],
}

create src/index.js

export function someFunction() {
	return 1234;
};

create src/tests.js

import { expect } from 'chai';
import { someFunction } from './index';

describe('Test Module', () => {
   it('test addition', () => {
       expect(1233 + 1).to.equal(someFunction());
   });
});

add to package.json

"scripts": {
    "start": "webpack-dev-server -w"
},

finally, run

npm start

and in another shell tab open src/tests.js in Kakoune

kak src/tests.js

Usage with Typescript

Install types - only the "describe" and "it" jasmine-like globals are supported

npm i @types/jasmine @types/chai

add to tsconfig.json

{
  "compilerOptions": {
  	"sourceMap": true
  	
  	...

Usage with HtmlWebpackPlugin

Add excludeChunks: ['kiwi-tests'] like so:

{
    plugins: [
        new HtmlWebpackPlugin({
            title: 'App',
            excludeChunks: ['kiwi-tests'],
        }),
        new KiwiPlugin({ testEntry: './src/tests.js', headless: true }),
    ],
}

Developing the library

Run npm start.

Run an example in the examples dir.

or for console.log debugging:

add console.log(1) in a source file

Kakoune Interface Tests

Replace kakoune_interface_tests with the test file of choice if needed.

npm i; npm start
# In another shell session
npm i -g nodemon
nodemon dist/kakoune_interface_tests.js
# or
nodemon dist/unit_tests.js

Using Kakoune Interface Tests:

edit src/kakoune_interface_tests.ts

The test file itself is used to display interface items

Unit Tests

# Build the minimal example with source maps
(cd examples/minimal && npm i && npm run build)

npm i
npm test