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

@manbitestech/nsmock

v0.0.2

Published

NetSuite Unit Testing: A jest-based unit test framework designed for offline testing of SuiteScripts

Readme

@manbitestech/nsmock

NetSuite Unit Testing: nsmock is a Jest-based unit test framework that enables rapid offline development of NetSuite SuiteScript code.

@manbitestech/nsmock provides a set of mock objects and a Jest configuration that allows you to test your SuiteScripts in a local environment, without needing to connect to a NetSuite instance. This enables faster development cycles and more robust testing.

Note on the name: the package is published under the scoped name @manbitestech/nsmock. The unscoped name nsmock is unavailable on the npm registry (blocked as too similar to the existing ns-mock package), so all installs and requires use the scoped form.

Core Principles

This project is designed to mock NetSuite's native behavior, i.e. real SuiteScript use cases. In all cases, tailor functions and tests to reflect NetSuite's real world behavior. nsmock is designed to be a developer's tool, not an exact simulation of NetSuite. It does not guarantee your code will work.

Installation

To use @manbitestech/nsmock in your project, install it as a dev dependency:

npm install --save-dev @manbitestech/nsmock

Usage

To use @manbitestech/nsmock, you need to configure your Jest setup to use its custom stubs. Below is an example of a jest.config.js file. @manbitestech/nsmock adds stubs which override the Oracle defaults.

const SuiteCloudJestConfiguration = require("@oracle/suitecloud-unit-testing");
const nsMockConfig = require("@manbitestech/nsmock");

module.exports = SuiteCloudJestConfiguration.build({
    projectFolder: 'src',
    projectType: SuiteCloudJestConfiguration.ProjectType.ACP,
    verbose: true,
    testMatch: ['<rootDir>/__tests__/**/*.test.js'],
    testPathIgnorePatterns: ['/node_modules/'],
    customStubs: nsMockConfig
});

Example

Here's an example of how you can write a test using @manbitestech/nsmock:

import Record from "N/record/instance";
import record from "N/record";

const salesOrder = new Record({
    objData: {
        id: 11211,
        type: record.Type.SALES_ORDER,
        fields: {
            memo: { value: "Hello Furman" }
        }
    }
});
record._preload([salesOrder]);

describe("simple getValue test", () => {
    it("gets the value of 'memo' field correctly", () => {
        const order = record.load({ id: 11211, type: record.Type.SALES_ORDER });
        const memo = order.getValue({ fieldId: 'memo' });
        expect(memo).toBe("Hello Furman");
    });
});

Supported Modules

@manbitestech/nsmock provides custom stubs for the following NetSuite modules:

| Module | Highlights | |--------|-----------| | N/record | create, load, save, transform, getValue/setValue, getText/setText, standard & dynamic sublists, subrecords, isDynamic | | N/record/instance | The Record class (exported directly) | | N/search | create, run, ResultSet.each/asMappedResults, Type/Operator enums | | N/error | error, SuiteScriptError, UserEventError | | N/http | get, post, put, delete, request with configurable responses | | N/https | get, post, put, delete, request, createSecretKey, createSecureString |

Test utilities

The stubs expose underscore-prefixed helpers for seeding state in tests:

  • record._preload(recordOrArray) — seed records for load()
  • record._precreate(recordOrArray) — register records available for create()
  • record._startId(value) — set the starting auto-assigned id
  • record._init() / record._clearDb() — reset state between tests
  • Record._initType(type) — create a bare record of a given type
  • search._setResults(type, results) / search._clearResults() — seed search results
  • http._setResponse(config) / https._setResponse(config) — configure mock responses

Companion Project

For a more detailed and practical example of how to use @manbitestech/nsmock, check out the companion project: usage-testing.

Repository

The source code for @manbitestech/nsmock is available on GitHub: https://github.com/manbitestech/nsmock

License

This project is licensed under the ISC License.