Skip to content

Commit b72d1a3

Browse files
committed
Add CI test verifying Mustache works with Deno
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.
1 parent c28d73b commit b72d1a3

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.github/workflows/verify.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Verify changes
22

33
on: [push, pull_request]
44

5-
jobs:
5+
jobs:
66
tests:
77
runs-on: ubuntu-latest
88

@@ -71,3 +71,14 @@ jobs:
7171
run: |
7272
npm ci
7373
npx mocha test/module-systems/browser-test.js
74+
75+
deno-usage:
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- uses: actions/checkout@v1
80+
- uses: denolib/setup-deno@v1
81+
with:
82+
deno-version: 'v0.23.0'
83+
- run: deno --version
84+
- run: deno test --allow-net=deno.land test/module-systems/deno-test.ts

test/module-systems/deno-test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { test } from "https://deno.land/[email protected]/testing/mod.ts";
2+
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
3+
import mustache from "../../mustache.mjs";
4+
5+
const view = {
6+
title: "Joe",
7+
calc: function() {
8+
return 2 + 4;
9+
}
10+
};
11+
12+
test(function canUseMustache() {
13+
assertEquals(
14+
mustache.render("{{title}} spends {{calc}}", view),
15+
"Joe spends 6"
16+
);
17+
});

0 commit comments

Comments
 (0)