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

kintuba

v0.9.6

Published

kintuba is stub for a unittest, it can use the kintone global object.

Readme

kintuba

npm version Build Status License: MIT

kintuba is stub for a unittest, it can use the kintone global object.

Description

kintuba はnode.js上で動作する kintone オブジェクトのスタブモジュールです。kintone カスタマイズの JavaScript をローカル開発環境でテストする際に使用できます。


通常 kintone カスタマイズの JavaScript をテストしようとすると、kintone オブジェクトにアクセスできない為以下のエラーが発生します。

ReferenceError: kintone is not defined

kintuba を使用すると、kintone オブジェクトのような振る舞いをしたり、予め用意したテストデータを kintone のデータのように扱ったりすることができます。

また、karma でブラウザを使用したテストをする場合は、karma プラグインを併せて利用して下さい。

https://github.com/t-kojima/karma-kintuba

Warning

kintuba はrequireされるとグローバルのkintoneオブジェクトを上書きします。(これは kintone にアップロードする JavaScript ファイルをそのままテストできるようにする為です。)

その為ローカルでのテストでのみの使用とし、本番環境では使用しないで下さい。

Installation

npm install --save-dev kintuba

or

yarn add --dev kintuba

Usage

テストコードでrequireして下さい。以後テストコード及びテスト対象コードでkintoneオブジェクトが利用できます。

require('kintuba');

イベントの実行

kintone では画面の移動等でイベントが実行されますが、ローカル環境ではそのような動作ができませんので kintuba ではイベントを実行する関数を用意しています。

kintone.events.onでイベントを登録するのに対し、kintone.events.doでイベントを実行します。

kintone.events.on('app.record.index.show', event => {
  console.log('event done');
});
kintone.events.do('app.record.index.show');

// => event done

また、レコード詳細画面を開いた場合など、特定の状況を表現する場合はoptionを指定します。

kintone.events.on('app.record.detail.show', event => {
  console.log(event.record.$id.value);
});
kintone.events.do('app.record.detail.show', { recordId: '2' });

// => 2

尚、kintone.events.doは非同期で動作する点に注意して下さい。

テストデータの利用

kintuba をrequireしただけではデータが存在しない為、event.records などにアクセスしても空配列が返ります。テストデータを返すようにするには、テストデータを用意し以下の手順で都度読み込んでください。また、テストデータの作成はここを参考に行ってください。

schema

schema.load() を実行すると、.kintuba/schema ディレクトリにある以下のファイルを読み込みます。

  • app.json
  • fields.json
  • form.json
  • views.json

使用例)

const schema = require('kintone/schema');

describe('example', () => {
  before(() => schema.load());
});

既定のディレクトリ(.kintuba/schema)以外にあるファイルを読みたい場合は引数で指定することができます。

schema.load('other/dir');
// other/dir/app.json 等がロードされる

fixture

fixture.load()を実行すると、.kintuba/fixtureディレクトリにある以下のファイルを読み込みます。

  • login.json
  • records.json

使用例)

const fixture = require('kintone/fixture');

describe('example', () => {
  before(() => fixture.load());
});

また、既定のディレクトリ以外を読む場合は引数で指定します。

fixture.load('other/dir');
// other/dir/login.json等がロードされる

Licence

MIT License.