doctest

Doctests for JavaScript (and CoffeeScript)

WTFPL License

Downloads
6.8K
Stars
164
Committers
6
doctest - Version 0.21.0 Latest Release

Published by davidchambers 10 months ago

Changes:

  • doctest now uses import.meta.resolve to support relative and bare specifiers in import declarations (#177)
doctest - Version 0.20.0

Published by davidchambers 11 months ago

Changes:

  • ⚠️ doctest’s source files are now ECMAScript modules (#146)
  • ⚠️ --coffee is now necessary to test CoffeeScript files (#152)
  • ⚠️ doctest no longer supports AMD (#157)
  • ⚠️ doctest now provides richer representations of test results (#164)
  • ⚠️ output lines must now be contiguous with input lines (#155)
  • --type js is now assumed for files without extensions (#149)
  • exit code is now 0 if no files are specified (#150)
  • doctest no longer creates temporary files (#165)
  • __filename now refers to the source file rather than a temporary file (#165)
  • doctest now supports CommonJS modules written in CoffeeScript (#165)
  • doctest now supports ECMAScript 2023 (#173)
  • acorn dependency upgraded from 8.5.x to 8.11.x (#166)
  • coffeescript dependency upgraded from 1.12.x to 2.7.x (#153, #167)
  • sanctuary-show dependency upgraded from 2.0.x to 3.0.x (#168)
  • sanctuary-type-classes dependency upgraded from 12.1.x to 13.0.x (#169)
doctest - Version 0.19.0

Published by davidchambers almost 3 years ago

Changes:

  • doctest now supports ECMAScript 2020 (#138)
  • acorn dependency upgraded from 7.3.x to 8.5.x (#139)
  • sanctuary-show dependency upgraded from 1.0.x to 2.0.x (#140)
  • sanctuary-type-classes dependency upgraded from 10.0.x to 12.1.x (#141, #142, #143)
doctest - Version 0.18.1

Published by davidchambers about 3 years ago

Changes:

  • examples of JavaScript interface are now accurate (#135)
doctest - Version 0.18.0

Published by davidchambers about 3 years ago

Changes:

  • ⚠️ doctest now requires Node.js ≥ v10.2.0 (#124, #131)
  • ⚠️ JavaScript interface is now doctest (options) (path) rather than doctest (path, options) (#125)
  • doctest now uses Acorn rather than Esprima to parse JavaScript syntax (#129)
doctest - Version 0.17.1

Published by davidchambers over 5 years ago

Changes:

  • Node.js v12 is now supported (#119)
doctest - Version 0.17.0

Published by davidchambers over 5 years ago

Changes:

  • ⚠️ doctest now returns a promise (#113)
  • doctest now supports ECMAScript modules in Node.js ≥ v9.0.0 (#113)
  • commander dependency upgraded from 2.19.x to 2.20.x (#116)
doctest - Version 0.16.0

Published by davidchambers over 5 years ago

Changes:

  • opening and closing delimiters—such as ```javascript and ```—may now be specified (#110)
  • coffeescript dependency upgraded from 1.10.x to 1.12.x (#103)
  • commander dependency upgraded from 2.8.x to 2.19.x (#104)
  • sanctuary-type-classes dependency upgraded from 9.0.x to 10.0.x (#105)
doctest - Version 0.15.0

Published by davidchambers over 6 years ago

Changes:

  • ⚠️ doctest now uses show for string representations (#100)
  • sanctuary-type-classes dependency upgraded from 8.1.x to 9.0.x (#101, #102)
doctest - Version 0.14.0

Published by davidchambers over 6 years ago

Changes:

  • ⚠️ doctest no longer runs in the browser (#86)
  • doctest is now much faster, and no longer depends on ramda (#89)
  • input/output wrapping is now documented (#91)
  • coffeescript is now used in place of deprecated coffee-script dependency (#92)
  • esprima dependency upgraded from 3.1.x to 4.0.x (#93)
doctest - Version 0.13.0

Published by davidchambers almost 7 years ago

This release improves webpack compatibility as a result of #83.

Sometimes usage examples must reference data constructors which are not in scope. These can be imported in the doctests themselves:

//. > var List = require('./test/internal/List')
//. > var Nil = List.Nil
//. > var Cons = List.Cons
//.
//. > reverse(Nil)
//. Nil
//.
//. > reverse(Cons(1, Cons(2, Cons(3, Nil))))
//. Cons(3, Cons(2, Cons(1, Nil)))

The above approach may not be optimal when using Transcribe, as the preamble will be included in the generated readme. To keep the readme clean, one may include doctest-specific imports in the source code itself, guarded to ensure they are ignored in other contexts:

if (typeof __doctest !== 'undefined') {
  var List = require('./test/internal/List');
  var Nil = List.Nil;
  var Cons = List.Cons;
}

The above approach does not work well in conjunction with build tools such as webpack, which attempt to include guarded modules when generating a bundle. This is particularly problematic for those who depend on the package in question: test modules are not distributed, so ./test/internal/List will not exist.

Fortunately, webpack can be tricked. This release introduces __doctest.require, which is simply a reference to require. The indirection is sufficient to throw webpack off the scent:

if (typeof __doctest !== 'undefined') {
  var List = __doctest.require('./test/internal/List');
  var Nil = List.Nil;
  var Cons = List.Cons;
}
doctest - Version 0.12.0

Published by davidchambers almost 7 years ago

doctest - Version 0.11.0

Published by davidchambers almost 7 years ago

doctest - Version 0.10.0

Published by davidchambers almost 7 years ago

doctest - Version 0.9.0

Published by davidchambers almost 7 years ago

doctest - Version 0.8.0

Published by davidchambers almost 7 years ago

doctest - Version 0.7.1

Published by davidchambers almost 7 years ago

doctest - Version 0.7.0

Published by davidchambers almost 7 years ago

doctest - Version 0.6.1

Published by davidchambers almost 7 years ago

doctest - Version 0.6.0

Published by davidchambers almost 7 years ago