Selaa lähdekoodia

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.
pull/728/head
Phillip Johnsen 6 vuotta sitten
vanhempi
commit
cc7b28293f
2 muutettua tiedostoa jossa 29 lisäystä ja 1 poistoa
  1. +12
    -1
      .github/workflows/verify.yml
  2. +17
    -0
      test/module-systems/deno-test.ts

+ 12
- 1
.github/workflows/verify.yml Näytä tiedosto

@@ -2,7 +2,7 @@ name: Verify changes


on: [push, pull_request] on: [push, pull_request]


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


@@ -71,3 +71,14 @@ jobs:
run: | run: |
npm ci npm ci
npx mocha test/module-systems/browser-test.js 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
- 0
test/module-systems/deno-test.ts Näytä tiedosto

@@ -0,0 +1,17 @@
import { test } from "https://deno.land/std@v0.21.0/testing/mod.ts";
import { assertEquals } from "https://deno.land/std@v0.21.0/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"
);
});

Loading…
Peruuta
Tallenna