Socket
Socket
Sign inDemoInstall

karton

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karton

Create sandbox for package e2e tests


Version published
Maintainers
1
Created
Source

karton

Test your package in a sandbox 📦

⚠️ In development ⚠️

Installation

This package requires minimum Node.js 10

# with npm
npm install --save-dev karton

# with yarn
yarn add --dev karton

Usage

This package helps you with writing E2E tests for your packages. Example:

import { 
  createSandbox,
  Sandbox, 
  packLocalPackage
} from "karton";
import path from 'path';

describe('my-package', () => {
  let sandbox: Sandbox;

  beforeAll(async () => {
    sandbox = await createSandbox({
      lockDirectory: path.resolve(__dirname, '__locks__'),
      fixedDependencies: {
        'my-package': `file:${await packLocalPackage(
          path.resolve(__dirname, '../../')
        )}`
      }
    });
  });
  afterEach(async () => {
    await sandbox.reset();
  });
  afterAll(async () => {
    await sandbox.cleanup();
  })

  it.each([
    [{ 'webpack': '^4.0.0' }],
    [{ 'webpack': '^5.0.0' }]
  ])('works with %p', async (dependencies) => {
    await sandbox.load(path.join(__dirname, 'fixtures/basic'));
    await sandbox.install('yarn', dependencies);
    const result = await sandbox.exec('node src/test.js');
    
    expect(result).toEqual('my-package awesome output');
  });
})

License

MIT

FAQs

Package last updated on 28 Feb 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc