New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

test-dome

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-dome

Comprehensive environment for isolated high level testing.

latest
Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
14
Maintainers
1
Weekly downloads
 
Created
Source

Installation

To install test dome use command npm install --save-dev test-dome. It is recommended to use TestDome with mocha framework.

Introduction

TestDome is library that currently stubs fs module. It should behave exactly like node.js module, but without operating on actual file system.

Usage

First require("testDome"); module in your test case. In your test step enclose your module under test with testDome.enclose(pathToModule, options);. In mocha framework it will automatically .release system modules, but in other frameworks (like nodeunit) you may do it manually.

Example test file

var testDome = require("test-dome");
var expect = require("chai").expect;

describe("Your code", function() {
    it("should hello world in file at specified path", function() {
        var codeUT = testDome.enclose("./pathToCode", {
            enabled: {
                vfs: true
            }
        });
        codeUT.writeHello("/tmp/helloWorld.txt");
        
        expect(testDome.vfs.getDataOfFile("/tmp/helloWorld.txt", "utf8")).to.equal("Hello World!");
    });
});

Roadmap

Current step

My current target is to mimic whole fs module and test it against external libraries like fs-extra, q, bluebird

Next Steps

  • Allow to use proxyquire and zurvan for checking against time
  • Mimic http module
  • Mimic net module
  • Mimic child_process module
  • Add good mocking solution

FAQs

Package last updated on 19 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts