0.0.10 • Published 5 years ago

mocha-flaptastic v0.0.10

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

mocha-flaptastic

Mocha plugin for Flaptastic.

https://www.flaptastic.com/

Installation

To install mocha-flaptastic:

$ npm install mocha-flaptastic --save-dev

Configuration

In your tests directory, create a mocha.opts file containing this:

--require mocha-flaptastic
--ui mocha-flaptastic

Environment variables:

RequiredEnvironment Variable NameDescription
YesFLAPTASTIC_ORGANIZATION_IDOrganization id
YesFLAPTASTIC_API_TOKENAPI token
YesFLAPTASTIC_SERVICEName of service (aka microservice) under test
NoFLAPTASTIC_BRANCHBranch name being tested. In git, you might pass "master" or names like "myFeature"
NoFLAPTASTIC_COMMIT_IDVersion id of code tested. In git, this would be the commit sha
NoFLAPTASTIC_LINKLink to CI (Jenkins/Circle/Travis etc) website page where you can find the full details of the test run, if applicable
NoFLAPTASTIC_VERBOSITYStdout verbosity. 0=none 1=minimal 2=everything

Example call pattern:

$ FLAPTASTIC_ORGANIZATION_ID=123 \
  FLAPTASTIC_API_TOKEN=foo \
  FLAPTASTIC_SERVICE=monolith \
  FLAPTASTIC_BRANCH=master \
  FLAPTASTIC_COMMIT_ID=2feffa9bf0bf3fc48f9f9e89c5386afe0cb77124 \
  FLAPTASTIC_LINK=http://jenkins.example.com \
  npm run test

CircleCI 2.0 Configuration

A simple project might have a CircleCI 2.0 YML that ultimately does a 'make test' like this:

      - run: make test

In CircleCI 2.0, we must map some of Circle's variables to Flaptastic varibles and include the Flaptastic organization id like this:

      - run:
          name: Run Mocha With Flaptastic
          environment:
            FLAPTASTIC_ORGANIZATION_ID: "<your org id goes here>"
            FLAPTASTIC_VERBOSITY: 1
          command: |
            echo 'export FLAPTASTIC_BRANCH=$CIRCLE_BRANCH' >> $BASH_ENV
            echo 'export FLAPTASTIC_LINK=$CIRCLE_BUILD_URL' >> $BASH_ENV
            echo 'export FLAPTASTIC_SERVICE=$CIRCLE_PROJECT_REPONAME' >> $BASH_ENV
            echo 'export FLAPTASTIC_COMMIT_ID=$CIRCLE_SHA1' >> $BASH_ENV
            source $BASH_ENV
            npm run test

Please be sure to pass your selected organization ID as the actual ID value from your Flaptastic account as a string with double quotes. At the time of this writing, CircleCI will botch our 64-bit integer ids without the double quotes.

Finally, find your Flaptastic API token and then go to your CircleCI project page. Navigate to the project environment variables screen and create an enviornment variable called "FLAPTASTIC_API_TOKEN" and then paste your token as the value.

alt text

License

mocha-flaptastic is available under the MIT License.

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago