{"_id":"@clubedaentrega/test-spec","_rev":"12-87f831507182262d194e70b204ca94f6","name":"@clubedaentrega/test-spec","description":"A parser and runtime for markdown-inspired documentation and testing files","dist-tags":{"latest":"1.5.1"},"versions":{"1.0.0":{"name":"@clubedaentrega/test-spec","version":"1.0.0","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=4.2"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md -t jaguarjs-jsdoc"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.3.4","should":"^8.0.2"},"gitHead":"5f913d7a2d3287d9e675cfb05353df7b94b0d540","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.0.0","_shasum":"20dbf19f1a710f282531f874ddf20905d1e0410d","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"20dbf19f1a710f282531f874ddf20905d1e0410d","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.0.0.tgz","integrity":"sha512-Gpa8w/+reAJFNBS0Cjd+QGpY8kmmeee8P1RMyYVbXmOqRtEOj1b2RDRTjLThHflK0b2m8Ldojvy82e2gNeu7oQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC3zRysKB2mF6XfXAuhw0Kx5Mz/ugWK/5Ts7MX/rlGjHAiB77ctLfQyVSciw6wUXcM+YP2Fj14AuN6waxesjNR2lIg=="}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"}]},"1.0.1":{"name":"@clubedaentrega/test-spec","version":"1.0.1","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=4.2"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.3.4","should":"^8.0.2"},"gitHead":"bb332d1e9a58185d4834aba72b2cc70f4a2a09f1","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.0.1","_shasum":"1ce5569bfe9081405388e75b72cd2107a297854d","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"1ce5569bfe9081405388e75b72cd2107a297854d","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.0.1.tgz","integrity":"sha512-chbJpXczBB4J5g3fSKPUSU+IAjr/iFsD+Ml8gGw06b/KlDajB5faxacNf/xbIdVOjwwlxf4/dzxU3YTD8Kzpkw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUYkDBjRQKm57qloIMOWY6ntDjcIZfLw2vkvPO1nvBRwIhAO/ummgP3b7Uokj8KVLGEfBGHKV2y/wpC82UNIoKqEF4"}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},{"name":"sitegui","email":"sitegui@sitegui.com.br"}]},"1.1.0":{"name":"@clubedaentrega/test-spec","version":"1.1.0","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=0.12"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.4.5","should":"^8.2.2"},"gitHead":"add178c0e7c9997ceaecaf3c043b0e78acc40acb","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.1.0","_shasum":"3576a04b219f0747b20959e6938965dc7b405435","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"3576a04b219f0747b20959e6938965dc7b405435","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.1.0.tgz","integrity":"sha512-TcbVu13a2yEfvoCmPlJxbiLSeG38xIkKIzX7yXv19AX16U3GpP5bbATMZXzrCpFk6v5d/gFggPRDyXgaUiPc4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDski7atAx+TnR8Q6mpbo8elCsXsmJ7cyXnPyp8VV+ZwgIhALW7YWS4AVOloTK9+d2DDeFdQfWjNpS0rU7KNKsuTxxA"}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},{"name":"sitegui","email":"sitegui@sitegui.com.br"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/test-spec-1.1.0.tgz_1456409026869_0.018366999691352248"}},"1.2.0":{"name":"@clubedaentrega/test-spec","version":"1.2.0","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=0.12"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.4.5","should":"^8.2.2"},"gitHead":"3d0e2cdaaeb0cdbdcad79a1a66e1be8c08069960","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.2.0","_shasum":"dd173fdb8a81284d5b4a3d415e7d65b55912a0e6","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"dd173fdb8a81284d5b4a3d415e7d65b55912a0e6","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.2.0.tgz","integrity":"sha512-0RNZxoN86EfFMhjJatOJNqtdBC3s/Qqy5eTNPs9I5uBM8KXSidDOVvL0SWVVppwn0oMLs6KIMzsgroi66f3Qow==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH2opF+3S1yay0FdX2wvua05qHybB1Qa62u06bMPM2/DAiEA+VX3ZPkprAKipBJp3eWTDcRdrs5/rbleAEtloRA4MsA="}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},{"name":"sitegui","email":"sitegui@sitegui.com.br"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/test-spec-1.2.0.tgz_1456751104799_0.5530203660018742"}},"1.3.0":{"name":"@clubedaentrega/test-spec","version":"1.3.0","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=0.12"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.4.5","should":"^8.2.2"},"gitHead":"e3e7633e7b047ac586ab862076a6e90a472ef09b","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.3.0","_shasum":"661ae7b064531f158b486f8bb6079cff2063fec6","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"661ae7b064531f158b486f8bb6079cff2063fec6","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.3.0.tgz","integrity":"sha512-kP06d5APDg1LQn5a2WAPMUPW8obp1h/BeCfNHnHQ/zTIyV0sNg54T44osghtqLWOggY/WVpRuuGHjHTyJ9c7YA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHeXdI6KRtyrNBSatn7IQ2lkYPqe2N4IfEQlFw3IVsLPAiEA/u3xqR5Toudp28WPgTsQa1X4x5eyaitA4MbnX1Itmac="}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},{"name":"sitegui","email":"sitegui@sitegui.com.br"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/test-spec-1.3.0.tgz_1457453710018_0.5865149351302534"}},"1.4.0":{"name":"@clubedaentrega/test-spec","version":"1.4.0","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=0.12"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.4.5","should":"^8.2.2"},"gitHead":"c65e09578edb2301c19afe5b16aeff62a94414b3","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.4.0","_shasum":"75c3379e4ad4750a78887f7d3ffdc06a3e92dda8","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"75c3379e4ad4750a78887f7d3ffdc06a3e92dda8","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.4.0.tgz","integrity":"sha512-kZvFwiWGtf9qs7+F+iLlhopp/W4oV//x7oLg3vdD6hcs8e3bYOd4eo2xbKzX6PoxKO84jupHTV7kv9zNsFef0g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBPZIgbPox0FrUQnFS6oFreJSv1sCyDdrSuRK2E+3HQCAiAis2OHRyoVqy7kVhc9f15lP6y5PQzO/5dbhjvVXTJrUQ=="}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},{"name":"sitegui","email":"sitegui@sitegui.com.br"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/test-spec-1.4.0.tgz_1457559020536_0.5306684437673539"}},"1.5.0":{"name":"@clubedaentrega/test-spec","version":"1.5.0","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=0.12"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.4.5","should":"^8.2.2"},"gitHead":"47f22819063bef5003bb77711447f7a8ece2c0ec","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.5.0","_shasum":"98192a45ff4538d87c50c14ab42a54204e2e1885","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"98192a45ff4538d87c50c14ab42a54204e2e1885","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.5.0.tgz","integrity":"sha512-lZRl0o6m0GvjHGxdtSRS4MbO3x1x/xjER0R7a5u/+K0Hb4diA4idpWcDZx9kcG6FBhB/ilyi5DSL+s0s2GTS+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXG8lS72qJMqCWLHiuW+3mvgjazjdvO6FMMZOUozcl4wIgBkDjkxyGwc3Fe5az48XAOWUngylUradj7X3DoknMvNU="}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},{"name":"sitegui","email":"sitegui@sitegui.com.br"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/test-spec-1.5.0.tgz_1457634462852_0.31540861655957997"}},"1.5.1":{"name":"@clubedaentrega/test-spec","version":"1.5.1","author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"description":"A parser and runtime for markdown-inspired documentation and testing files","main":"./index.js","repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"keywords":[],"dependencies":{},"license":"MIT","engines":{"node":">=0.12"},"scripts":{"test":"mocha test","docs":"jsdoc -d docs -c docs.json -R README.md"},"devDependencies":{"jsdoc":"^3.4.0","mocha":"^2.4.5","should":"^8.2.2"},"gitHead":"c0fedfd896c66504ec3e2930de81aed8cdc92a5c","bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","_id":"@clubedaentrega/test-spec@1.5.1","_shasum":"2823bc2ab3f32882f19ba4d6919f3d6e06d07fb5","_from":".","_npmVersion":"2.15.8","_nodeVersion":"4.4.7","_npmUser":{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},"dist":{"shasum":"2823bc2ab3f32882f19ba4d6919f3d6e06d07fb5","tarball":"https://registry.npmjs.org/@clubedaentrega/test-spec/-/test-spec-1.5.1.tgz","integrity":"sha512-dTsOeYEypZK0Q9q78Yj0xSvCZNK84PQmtj0wwS95uP9tSaiRj93/ZM174tl3mRxBiYBwPZg2mQeQFVJ0GhyTcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrFM1hM6TMgNYZod6XEv1Mwrocef+oH+r8zefHLU/upwIhANGs2owXavaXl5B17Mk0KK9jvGScASWhiqoQnGOL5wws"}]},"maintainers":[{"name":"clubedaentrega","email":"cde@clubedaentrega.com.br"},{"name":"sitegui","email":"sitegui@sitegui.com.br"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/test-spec-1.5.1.tgz_1469472068307_0.062165832379832864"}}},"readme":"# Test Spec Parser\n[![Build Status](https://travis-ci.org/clubedaentrega/test-spec.svg?branch=master)](https://travis-ci.org/clubedaentrega/test-spec)\n[![Inline docs](http://inch-ci.org/github/clubedaentrega/test-spec.svg?branch=master)](http://inch-ci.org/github/clubedaentrega/test-spec)\n[![Dependency Status](https://david-dm.org/clubedaentrega/test-spec.svg)](https://david-dm.org/clubedaentrega/test-spec)\n\nA parser and runtime for markdown-inspired documentation and testing files\n\n## Install\n`npm install @clubedaentrega/test-spec --save`\n\n## Usage\n```js\nvar spec = require('@clubedaentrega/test-spec')\n\n// Usually, the source is read from some *.md file\nvar source = '# Title\\n'+\n\t'## Sub section\\n'+\n\t'Some textual content\\n'+\n\t'\\tuser:\\n'+\n\t'\\t\\tname: \"Gui\".toUpperCase()'\n\n// Compile the source to a tree of section, text and value blocks\nvar mainSection = spec.compile(source),\n\tsubSection = mainSection.children[0],\n\tvalueBlock = subSection.children[1],\n\t// Execute the value block\n\tvalue = valueBlock.run()\n\nconsole.log(value) // {user: {name: 'GUI'}}\n```\n\n## Concepts\nTesting is, at the same time:\n\n* *very* great because it lets you trust code is ready for production!\n* extremely *boring* to write, because test code is dumb and repetitive\n\nThis module tries to solve this by making testing code more concise and unifying testing and documentation.\n\nMarkdown was choosen because it's easy to write/read and it's not code!\n\nThis module is the fundamental parser and compiler for [api-test](https://github.com/clubedaentrega/api-test), but can be used separately.\n\n## Syntax and parsing\nThis module implements a tiny subset of markdown: headers, paragraphs and code blocks. It does not aim at understanding any other feature (like lists, images, links, etc), but those constructions are accepted. That is, they are not considered valid syntax, but are simply treated as text.\n\nThe source is first transformed into a tree of sections (headers). Each section may have sub-sections, text paragraphs and value blocks.\n\n## Compiling\nParsed values are compiled to native JS functions, exposing a `run()` method, like in example above.\n\n## Value syntax\nThe syntax for value expressions was designed to be concise and expressive. The values will be eval'ed as normal JS with a context with special variables (see `default context` bellow).\n\nThe object can be a simple JS value, like:\n```\nnew Date\n```\n\nOr an object with one property by line and tabs used to declare sub-objects:\n```\nuser:\n\tname:\n\t\tfirst: 'Happy'\n\t\tlast: 'Customer'\n\tage: 37 + 2\n\tcountry: 'cm'.toUpperCase()\n```\n\nOr mixins, like:\n```\nuser with name.first: 'Unhappy'\n```\n\nLearn more about the syntax in the file [value-syntax.md](https://github.com/clubedaentrega/test-spec/blob/master/value-syntax.md)\n\n## Default context\nThe following functions are defined in `spec.baseContext` and can be used to provide a common set of utility functions to tests.\n\n* `randomStr([len=8], [alphabet=a-zA-Z0-9+/])`\n* `randomHex([len=8])`\n* `randomCode([len=8])`\n* `randomEmail([domain='example.com'])`\n* `randomUrl([base='http://example.com'])`\n* `random([min=0],[max=1])`\n* `randomInt([min=0],[max=100])`\n* `randomBool()`\n* `randomDate([interval=1day], [base=now])`: return a random date in the past\n* `randomOf(...values)`: return one of its arguments\n* `empty`: the empty object `{}`\n\n## Docs\nSee [complete docs](http://clubedaentrega.github.io/test-spec)","maintainers":[{"email":"sitegui@sitegui.com.br","name":"sitegui"},{"email":"cde@clubedaentrega.com.br","name":"clubedaentrega"}],"time":{"modified":"2022-06-12T16:10:29.793Z","created":"2016-01-18T13:39:23.285Z","1.0.0":"2016-01-18T13:39:23.285Z","1.0.1":"2016-01-20T04:11:01.698Z","1.1.0":"2016-02-25T14:03:47.929Z","1.2.0":"2016-02-29T13:05:07.924Z","1.3.0":"2016-03-08T16:15:14.046Z","1.4.0":"2016-03-09T21:30:22.789Z","1.5.0":"2016-03-10T18:27:45.185Z","1.5.1":"2016-07-25T18:41:08.538Z"},"homepage":"https://github.com/clubedaentrega/test-spec#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/clubedaentrega/test-spec.git"},"author":{"name":"Sitegui","email":"sitegui@sitegui.com.br"},"bugs":{"url":"https://github.com/clubedaentrega/test-spec/issues"},"license":"MIT","readmeFilename":"README.md"}