@warp-drive/holodeck

0.0.0-alpha.50 • Public • Published

WarpDrive WarpDrive

⚡️ Simple, Fast HTTP Mocking

Ideal for Test Suites

WarpDrive Holodeck

  • ⚡️ Real network requests
    • brotli compression
    • http/2
    • no CORS preflight requests
  • 💜 Unparalleled DX
    • debug real network requests
    • every request is scoped to a test
    • run as many tests as desired simultaneously
  • 🔥 Blazing Fast Tests
    • record your tests when you change them
    • replays from cache until you change them again
    • zero-work: setup work is skipped when in replay mode

Installation

pnpm install @warp-drive/holodeck

Tagged Releases

  • NPM Canary Version
  • NPM Beta Version
  • NPM Stable Version
  • NPM LTS Version
  • NPM LTS 4.12 Version

Usage

Mocking from Within a Test

import { GET } from '@warp-drive/holodeck/mock';

await GET(context, 'users/1', () => ({
  data: {
    id: '1',
    type: 'user',
    attributes: {
      name: 'Chris Thoburn',
    },
  },

// set RECORD to false or remove
// the options hash entirely once the request
// has been recorded
}), { RECORD: true });

Motivations

Comprehensive DX around data management should extend to testing.

✨ Amazing Developer Experience

EmberData already understands your data schemas. Building a mocking utility with tight integration into your data usage patterns could bring enormous DX and test suite performance benefits.

Building a real mock server instead of intercepting requests in the browser or via ServiceWorker gives us out-of-the-box DX, better tunability, and greater ability to optimize test suite performance. Speed is the ultimate DX.

🔥 Blazing Fast Tests

We've noticed test suites spending an enormous amount of time creating and tearing down mock state in between tests. To combat this, we want to provide an approach built over http/3 (http/2 for now) utilizing aggressive caching and brotli minification in a way that can be replayed over and over again.

Basically, pay the cost when you write the test. Forever after skip the cost until you need to edit the test again.

♥️ Credits

Brought to you with ♥️ love by 🐹 Ember <style type="text/css"> img.project-logo { padding: 0 5em 1em 5em; width: 100px; border-bottom: 2px solid #0969da; margin: 0 auto; display: block; } details > summary { font-size: 1.1rem; line-height: 1rem; margin-bottom: 1rem; } details { font-size: 1rem; } details > summary strong { display: inline-block; padding: .2rem 0; color: #000; border-bottom: 3px solid #0969da; } details > details { margin-left: 2rem; } details > details > summary { font-size: 1rem; line-height: 1rem; margin-bottom: 1rem; } details > details > summary strong { display: inline-block; padding: .2rem 0; color: #555; border-bottom: 2px solid #555; } details > details { font-size: .85rem; } @media (prefers-color-scheme: dark) { details > summary strong { color: #fff; } } @media (prefers-color-scheme: dark) { details > details > summary strong { color: #afaba0; border-bottom: 2px solid #afaba0; } } </style>

Readme

Keywords

Package Sidebar

Install

npm i @warp-drive/holodeck

Weekly Downloads

127

Version

0.0.0-alpha.50

License

MIT

Unpacked Size

52.1 kB

Total Files

15

Last publish

Collaborators

  • hm_krystan
  • richgt
  • ember-data-admin
  • runspired
  • hjdivad
  • rwjblue
  • stefanpenner
  • bmac
  • fivetanley
  • dgeb
  • igort
  • kellyselden
  • heroiceric