All Projects → ert78gb → google-datastore-emulator

ert78gb / google-datastore-emulator

Licence: other
Google Datastore Emulator wrapper to nodejs

Programming Languages

javascript
184084 projects - #8 most used programming language

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

google-pubsub-emulator
Google PubSub Emulator wrapper to nodejs
Stars: ✭ 28 (+64.71%)
Mutual labels:  emulator, test
vrcpu
Code, documentation, schematics, notes for my Ben Eater inspired breadboard computer and emulator
Stars: ✭ 98 (+476.47%)
Mutual labels:  emulator
carina-demo
Carina demo project.
Stars: ✭ 40 (+135.29%)
Mutual labels:  test
expectest
Crate provides matchers and matcher functions for unit testing.
Stars: ✭ 25 (+47.06%)
Mutual labels:  test
ansible-role-test-vms
DEPRECATED - A Vagrant configuration to test Ansible roles against a variety of Linux distributions.
Stars: ✭ 42 (+147.06%)
Mutual labels:  test
cypress-angularjs-unit-test
Unit test Angularjs code using Cypress.io test runner
Stars: ✭ 23 (+35.29%)
Mutual labels:  test
golang-example
⚡ Golang Clean Boilerplate
Stars: ✭ 15 (-11.76%)
Mutual labels:  test
nolimix86
LLVM-based x86 emulator with support for unlimited virtual registers, used before the register allocation pass
Stars: ✭ 19 (+11.76%)
Mutual labels:  emulator
DOSee
DOSee is a DOSBox based, MS-DOS emulator for the web
Stars: ✭ 24 (+41.18%)
Mutual labels:  emulator
pac-man-emulator
🕹 An emulator for the Pac-Man arcade machine (Zilog Z80 CPU) for Win/Mac/*nix and Xbox One.
Stars: ✭ 20 (+17.65%)
Mutual labels:  emulator
rasa-train-test-gha
A GitHub action to run easily rasa train and rasa test in the CIs.
Stars: ✭ 26 (+52.94%)
Mutual labels:  test
drevops
💧 + 🐳 + ✓✓✓ + 🤖 + ❤️ Build, Test, Deploy scripts for Drupal using Docker and CI/CD
Stars: ✭ 55 (+223.53%)
Mutual labels:  test
pytest-coverage-comment
Comments a pull request with the pytest code coverage badge and full report
Stars: ✭ 32 (+88.24%)
Mutual labels:  test
ng2-quiz
A general purpose quiz application developed in angular (updated to angular 8) that can be used for multiple purpose.
Stars: ✭ 90 (+429.41%)
Mutual labels:  test
z80e
A z80 calculator emulator (and debugger)
Stars: ✭ 65 (+282.35%)
Mutual labels:  emulator
helios
A Java-based Sega Mega Drive/Genesis emulator. And other systems too.
Stars: ✭ 14 (-17.65%)
Mutual labels:  emulator
SaltyNES
A NES emulator in WebAssembly
Stars: ✭ 69 (+305.88%)
Mutual labels:  emulator
debug.js
Debugger of JavaScript, by JavaScript, for JavaScript
Stars: ✭ 19 (+11.76%)
Mutual labels:  test
Chip8Java
A Super Chip 8 emulator written in Java
Stars: ✭ 23 (+35.29%)
Mutual labels:  emulator
first nes
Create your own games for the Nintendo Entertainment System! This "starter" game is easily extensible for your own projects. Includes references.
Stars: ✭ 94 (+452.94%)
Mutual labels:  emulator

Google Cloud Datastore Emulator

CI CodeQL

This package helps to start / stop Google Datatstore Emulator with javascript. From 1.1.0 also could usable with google/cloud-sdk docker image. The wrapper automatically pull the image is not exists on the host, but I suggest to pull the image in the 'before_test' section in the CI script Important: Be careful with the timeouts, need time to pull the image, start and stop the container.

Perfect to support unit testing where the persistent layer is the gcloud Datastore.

The wrapper sets DATASTORE_EMULATOR_HOST and DATASTORE_PROJECT_ID environment variables.

Prerequisites

To use the emulator locally you need to install Google Cloud SDK or with Docker you need to install Docker host

Installation

npm install google-datastore-emulator --save-dev

Usage

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

const datastore = require('@google-cloud/datastore');
const Emulator = require('google-datastore-emulator');

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

    let emulator;
    
    before(()=>{
        const options = {
            useDocker: true // if you need docker image
        };
        
        emulator = new Emulator(options);
        
        return emulator.start();
    });
    
    after(()=>{
        return emulator.stop();
    });
    
    it('test case', ()=>{
        // your test
    });
})

Options

parameter (type) default value description
project (string) test This variable is datastore project Id.
storeOnDisk (boolean) false The datastore either persists the entities on disk or not.
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. Bug : With linux Docker host don't delete the folder
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) localhost 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.
consistency (string) '1.0' The consistency level of the Datastore Emulator. More details
useDocker (boolean) false If it is true, it use docker image to run emulator instead of locally installed version.
dockerImage (string) 'google/cloud-sdk:latest' This image will be use by docker. The default: google/cloud-sdk:latest

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].