Skip to content

Commit

Permalink
Add CI test verifying Mustache works with Deno
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
phillipj committed Dec 18, 2019
1 parent c28d73b commit b72d1a3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Verify changes

on: [push, pull_request]

jobs:
jobs:
tests:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -71,3 +71,14 @@ jobs:
run: |
npm ci
npx mocha test/module-systems/browser-test.js
deno-usage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: denolib/setup-deno@v1
with:
deno-version: 'v0.23.0'
- run: deno --version
- run: deno test --allow-net=deno.land test/module-systems/deno-test.ts
17 changes: 17 additions & 0 deletions test/module-systems/deno-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test } from "https://deno.land/[email protected]/testing/mod.ts";
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import mustache from "../../mustache.mjs";

const view = {
title: "Joe",
calc: function() {
return 2 + 4;
}
};

test(function canUseMustache() {
assertEquals(
mustache.render("{{title}} spends {{calc}}", view),
"Joe spends 6"
);
});

0 comments on commit b72d1a3

Please sign in to comment.