All Projects → ert78gb → google-pubsub-emulator

ert78gb / google-pubsub-emulator

Licence: other
Google PubSub Emulator wrapper to nodejs

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to google-pubsub-emulator

google-datastore-emulator
Google Datastore Emulator wrapper to nodejs
Stars: ✭ 17 (-39.29%)
Mutual labels:  emulator, test
confirm-before
✅ Are you sure? No? Confirm Before - Sanity check for your shell commands
Stars: ✭ 16 (-42.86%)
Mutual labels:  wrapper
jest-expect-contain-deep
Assert deeply nested values in Jest
Stars: ✭ 68 (+142.86%)
Mutual labels:  test
nanoleaf-aurora
A java wrapper for the Nanoleaf Aurora API
Stars: ✭ 19 (-32.14%)
Mutual labels:  wrapper
py-SMART
Wrapper for smartctl (smartmontools)
Stars: ✭ 42 (+50%)
Mutual labels:  wrapper
islpy
Python wrapper for isl, an integer set library
Stars: ✭ 58 (+107.14%)
Mutual labels:  wrapper
packetevents
PacketEvents is a powerful packet library. Our packet wrappers are efficient and easy to use. We support many protocol versions. (1.8+)
Stars: ✭ 235 (+739.29%)
Mutual labels:  wrapper
inside-vm
Detect if code is running inside a virtual machine (x86 and x86-64 only).
Stars: ✭ 32 (+14.29%)
Mutual labels:  test
titef
🌠 A tiny, lightning-fast, zero-dependecies JavaScript test framework 🌠
Stars: ✭ 19 (-32.14%)
Mutual labels:  test
adl
🍿 anime-downloader + trackma wrapper
Stars: ✭ 91 (+225%)
Mutual labels:  wrapper
MathLib
The Math Algorithm
Stars: ✭ 38 (+35.71%)
Mutual labels:  test
viup
A V wrapper for the cross-platform UI library, IUP.
Stars: ✭ 36 (+28.57%)
Mutual labels:  wrapper
node-freshdesk-api
Node wrapper for Freshdesk v2 API
Stars: ✭ 24 (-14.29%)
Mutual labels:  wrapper
node-atol-wrapper
Node.js обертка для ДТО версии 10 компании АТОЛ
Stars: ✭ 28 (+0%)
Mutual labels:  wrapper
Chip8Python
A Super Chip 8 emulator written in Python
Stars: ✭ 65 (+132.14%)
Mutual labels:  emulator
genshinstats
A dead python library that can get the stats of Genshin Impact players using Mihoyo's API.
Stars: ✭ 217 (+675%)
Mutual labels:  wrapper
Xamarin-iOS
PSPDFKit for iOS wrapper for the Xamarin platform.
Stars: ✭ 14 (-50%)
Mutual labels:  wrapper
UnitySettings
Runtime debugging menu (like setting on Android) for Unity.
Stars: ✭ 26 (-7.14%)
Mutual labels:  test
MBBSEmu
The MajorBBS Emulation Project is an Open Source, Cross-Platform emulator for easily running The MajorBBS & Worldgroup Modules
Stars: ✭ 75 (+167.86%)
Mutual labels:  emulator
jodit-vue
Vue wrapper for Jodit Editor
Stars: ✭ 60 (+114.29%)
Mutual labels:  wrapper

CI CodeQL

Google Cloud PubSub Emulator

This package helps to start / stop Google Cloud Pub/Sub Emulator with javascript. Perfect to support unit testing when you need the local emulator start in unit / half integration test.

The wrapper sets PUBSUB_EMULATOR_HOST and GCLOUD_PROJECT environment variables.

From 2.0.0 @google-cloud/pubsub moved to the peer dependencies.

#Prerequisites To use the emulator you need to install Google Cloud SDK

#Installation

npm install google-pubsub-emulator --save-dev

#Usage I think the package is the most suitable for unit testing.

const {PubSub} = require('@google-cloud/pubsub');
const Emulator = require('google-pubsub-emulator');

describe('test suit', ()=>{
    process.env.GCLOUD_PROJECT = 'project-id'; // Set the gcloud project Id globally

    let emulator;
    
    before(()=>{
        const options = {
            debug:true, // if you like to see the emulator output
            topics: [
                'projects/project-id/topics/topic-1' // automatically created topic
            ]
        };
        
        emulator = new Emulator(options);
        
        return emulator.start();
    });
    
    after(()=>{
        return emulator.stop();
    });
    
    it('test case', ()=>{
        // your test
    });
})

Options

parameter (type) default value description
project (string) empty This variable is gcloud project Id. If it is empty, GCLOUD_PROJECT environment variable will be used. Either you should set it directly or the environment variable should be set.
dataDir (string) empty The emulator creates a directory where the project files are stored. If it is empty the emulator default value will be used. You could set relative ./directory or absolute path /tmp/dir1/dir2/. If this directory does not exist, it will be created.
clean (boolean) true If dataDir value is set and 'clean' value is true then the package deletes the dataDir. The package does not delete the gcloud emulator default directory.
host (string) empty If it is empty the'localhost' of google default value is used. It can take the form of a single address (hostname, IPv4, or IPv6)
port (number) empty If it is empty the emulator selects a random free port.
debug (boolean) false If it is true, it writes the console.logs of the emulator onto the main process console.
topics (array) [] If it is contains values then the wrapper create the missing topics. You should set the full identifier of the topic 'projects//topics/'

Methods

name description
start Starts the emulator and returns a Promise.
stop Stops the emulator and returns a Promise.

#License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].