The web, nor node, are ready for ES6 modules at 2017-03-06.
This code is written for Nodejs. Browsers use is supported via
to create a browser distribution.
> npm run browserify
- on Mac, during development, with Node 8
- on Linux, with, via Travis
- on the 'latest' versions of the default browser, on
- Windows 10 - macOS High Sierra
- the 'latest' version of iOS - the 'latest' version of Android
BrowsersSome workarounds were made to accommodate different Safari. This only concerns using
Errorstack traces to report where a contract has failed.
Safari support for traces is bad. First of all, Safari haphazardly skips frames in its stack trace. Second, there is a difference in the stack traces generated when using Safari 'live', and via Web Driver. In the latter case, no lines or columns are reported, and the stack contains a lot of empty lines. As a result, it is impossible to return a sensible location of contract failure consistently with Safari. A best effort will need to suffice.
Furthermore, Safari on iOS is very weird in adding a default
prototypeobject to a non-arrow function. That should always be there, but experience shows it is sometimes 'late'. It seems to be added 'lazily'.
Environment detection is used in tests to exclude some conditions in some environments.
More extensive, and sadly fragile, browser detection is used in tests for Safari.
- I/2.3 : Cleanup, renaming, administration, license, fixing warnings - I/2.4 : Now also tests with Intern on Mac on Chrome, Safari, Firefox (3 failures, waiting for april version 53) - I/2.5 : Fix in behavior and test of util.browserModuleLocation - I/1.2.5 : Relax a test to support use of '(
changes private code, test code, and build setup.
- II/1.1 : Use scope in package name - II/1.2 : Cosmetic changes - II/2.1.3 : Relax a test to support use of '(
to start using it on node.
- III/3.0.1 : Relax a test to support use of '(
is "forwarded" to the contract function. The ECMAScript2015 "class" construct is not yet supported (a "class" generated constructor cannot be `call`ed or `apply`ed). This is an incompatible change, since we now require more of a general contract function. Also, from now on, we will use versioning differently. Since npm insists on semantic versioning, the major version number will be the arabic numeral of the roman mark version. We now use `yarn`, but that is optional.
- CI is realised completely, with automated tests for LTS Node versions and all major browsers on all major platforms. We no longer use Bitbucket or Bitbucket Pipelines. Everything is done with GitHub, [travis], and [browserstack] - dropped direct support for older JS and browsers - now geared toward Node 6 and higher; use `browserify` to support browsers - fixed display name - support arrow functions - By default, only preconditions are tested. Postcondition testing must be enabled, for all contracts, a particular contract, or 1 implementation, by setting `contract.verifyPostconditions = true`. All testing can be disabled by setting `contract.verify = false`. - Support `Promise` and `async` functions through `PromiseContract` (with `Contract.Promise` as alias)
- fix issue with stack trace of condition errors in Chrome ≥ v73
- fix bug with circular structures in this (and other arguments) with util.inspect (It actually turns out there are 2 separate, separate bugs in IntelliJ and mocha-reporter)
- fix bug in determination of Contract Violation location on Windows. It turns out that Node (8, at least) in Windows uses \n as EOL in stack traces, and not os.EOL.
- replace `must` with `should` in tests
- fix missing EOLs - these where lost in the 4.0.4 rebase
- test also on Node 12 and 13 (use 12 as dev env) - upgrade dependencies (dev) - fix test issue with async functions in Node 12 (a similar issue as with 4.0.1) (there is still a test issue with Node 12 and later when running tests in IntelliJ)
- fix test issue with Node 12 and later when running tests in IntelliJ
- fix bug in `isImplementedBy`: `cf.contract.isImplementedBy(cf)` did not work
- support Symbols as arguments - contract function `name` is now a true property, with the same settings as the implementation function name, and no longer a derived property (in response to https://github.com/sinonjs/sinon/issues/2203)
- ignore unnecessary files in distribution
- fix bug in dealing with `arguments`, when they contain a Symbol
- Upgrade to Mocha 8, but then we can no longer support Node 8