Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

literate-jasmine

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

literate-jasmine

write tests in markdown that are parsed to specification files to run with jasmine-node

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

literate-jasmine Build Status

NPM

The idea is to write markdown that gets translated to Jasmine describe and it blocks. Because we want to be able to annotate in between parts of what would become a single it, we make use of markdown hierarchy to separate one test from another and to give the it (and describe blocks names).

Below I've added this markdown structure (which includes the main header above):

literate-jasmine Mathematices (level 2 header) add can add numbers (level 3 header) code blocks which can be interspersed with comments add can add numbers Strings appending works with +

This will be parsed to:

describe('literate-jasmine', function() {
  describe('Mathematics', function() {
    it('add can add numbers', function() {
      // test code
    });
    it('can divide numbers', function() {
      // test code
    });
  });
  describe('Strings', function() {
    it('appending works with +', function() {
      // test code
    });
  });
});

To actually do the parsing (assuming you ran npm install -g literate-jasmine):

literate-jasmine README.md

Which will create README_spec.js with the parsed contents. If you're working on this project, simply run ./bin/literate-jasmine instead.

Mathematics

add can add numbers

var a = 1,
    b = 2;

console.log(a, b, a + b);

expect(a + b).toBe(3);

can divide numbers

var a = 6,
    b = 2;

And a comment here doesn't break things:

expect(a/b).toBe(3);

Strings

appending works with +

var text = "abc";

expect(text + "d").toBe("abcd");

FAQs

Package last updated on 13 Feb 2014

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