To ensure the ES module and source exposed by this package is compatible
with Deno going forward.
Added benefit is we get some sanity checks of the source code for free
due to Deno's built-in TypeScript compiler getting angry if it sees
things that does not make sense, in terms of missing function arguments
and so on.
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.
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>
* 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
* Fixes CLI tests for windows
* Hijacked exec so we don't have to wrap each command in changeForOS, and made replacing 'cat' safer with word boundaries
* Fixing changed tests to be more consistent with the code base
As we require the template to be a `string` we now throw an error when given
any other data type. This should provide the developers with a meaningful
error rather than a cryptic TypeError from the murky depths of our source code.
Fixes#464
Covers the project with browser tests, not only V8 via node/iojs. Tests are runned with [zuul](https://github.com/defunctzombie/zuul) which
provides simple local browser testing, aswell as cloud testing on multiple browsers with [saucelabs](http://saucelabs.com).
CLI used to render a mustache template with a data view, writes the template into stdout when successfull. Otherwise meaningfull errors into stderr.
Fixes#424