This is a precursor to introducing a build step that will change what
we expose from this package. Better off writing some tests to verify
existing projects with different module systems continue to work as
expected.
This is a precursor to introducing a build step that will change what
we expose from this package. Better off writing some tests to verify
existing projects with different module systems continue to work as
expected.
This is a precursor to introducing a build step that will change what
we expose from this package. Better off writing some tests to verify
existing projects with different module systems continue to work as
expected.
Because standard dev dependencies being installed for not-legacy versions,
has introduced some features or syntax constructs that simply won't
run for Node.js 6 and below.
Therefor running render-and-run-in-browser tests with Node.js 8 instead.
Primarily because it's been ages since we bumped eslint and as a precursor
to allowing some future test files to be written in a more modern type
of JavaScript. Especially think about tests written using puppeteer.js
which is heavily `Promise` based, where the async-await syntax makes
it soooo less painful to write.
Silly not being able to use that because of an outdated eslint version
doesn't understand that syntax construct at all.
Because there has been a deliberate effort from the Node.js project
to use the term `Node.js` rather than anything else. It also helps beginners
by being more explicit and self-descriptive.
When initially creating the GitHub Actions
workflow, it was obviously forgotten to make
it also run on pull requests, not only when
changes are pushed to branches in the
original repository (not a fork).
This small change fixes the output of functions used in partials with
indentation. Bug reports has shown that the functions output is shifted
with the amount of indentation the partial has.
The bug itself is best illustrated in the tests added in 621ae80652.
Closes https://github.com/janl/mustache.js/issues/712
While creating the `$ npm install` step in the
GitHub Actions workflow, I forgot to state the fact that
the `$ npm test` step "needs" the install deps step
to have successfully run first.
As a means of seeing how GitHub Actions
work compared to Travis CI, these changes creates
a so-called workflow that runs `$ npm test`
upon every `$ git push` to the repository.
In an effort of ensuring consistent code style in test files as with
the "production" source code, we should run eslint as part of the
`$ npm test` script as well.
Most of the related fixes was done by `eslint` using the `--fix` argument.
Only special configuration tweaks for tests compared to the other
source code, is to allow functions declaration without names. The
rationale for allowing that in tests, is that the important reason we
have them in the source code (proper stacktraces) aren't as important
in test files.
Fixes this failure:
1) Mustache CLI without partials writes rendered template into the file specified by the third argument:
Uncaught TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:136:11)
at Object.unlink (fs.js:943:14)
at test/cli-test.js:86:12
at ChildProcess.exithandler (child_process.js:285:7)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Primarily because it's very painful to install 3rd party packages
in the test phase of our CI runs, because many of them requires at least
Node.js 0.10 or even higher.
Therefore getting the test suite to run when using Node.js 0.8 is
far from trivial, and the benefit of ensure Node.js 0.8 support these
days is not obvious because it should really not be used knowing that
it has reached end-of-life a long time ago.
Worth noting there's no breaking changes in this commit to
mustache.js's source code, we just don't want to struggle getting our
CI to care about it. In other words, it should still be possible to use
Node.js 0.8, but we won't care much making sure it keeps working going
forward.
As of writing this, we cannot use the latest version of eslint v2.x
because there's something in there that causes explotions when run
with pre Node.js 1 installed.
* prevent value from being returned by Context.prototype.lookup if lookupHit is false
* add test for renderability of Array.length via dot notation
* Remove `typeof obj === 'object'` constraint in prop lookup
Allows rendering properties of primitive types that are not objects, such as a string.
* pop lookup needs to use hasOwnProperty for non-objs
* re-add constraint in prop lookup, but make property lookups for primitives possible through dot notation
* add test to address #589 specifically
* enhance readability of primitiveHasOwnProperty and add comments to explain why it is used in one case but not the other
Pull requests #643 and #664 together fix the issue reported in issue #617, but the change in behavior is causing semvers concerns. See issue #669. Therefore, roll back #643 and #664 and later reintroduce in next planned major release (v3.0).
Fixes#669
I made most of the `CHANGELOG.md` changes 2 August, but did not push the
version to npm until 7 August. Updating the changelog just in case anyone
updates and looks back on the changelog for clues of when things happen.