-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deno CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test-deno: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
deno: [v1.10.3] | ||
node-version: 16.x | ||
build-how: ["cdn"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install Deno ${{ matrix.deno }} | ||
run: | ||
curl -fsSL https://deno.land/x/install/install.sh | sudo | ||
DENO_INSTALL=/usr/local sh -s ${{ matrix.deno }} | ||
- run: npm install | ||
- run: node ./tools/build.js -t ${{ matrix.build-how }} | ||
- name: Run tests | ||
run: deno test test/deno/index.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { assertStrictEquals } from "https://deno.land/std@0.97.0/testing/asserts.ts"; | ||
|
||
import hljs from "../../build/es/core.js"; | ||
import js from "../../build/es/languages/javascript.min.js"; | ||
|
||
hljs.registerLanguage("javascript", js); | ||
|
||
Deno.test({ | ||
name: "should return relevance key", | ||
async fn() { | ||
const out = hljs.highlight("", { language: "javascript" }); | ||
assertStrictEquals(out.relevance, 0); | ||
}, | ||
}); | ||
|
||
Deno.test({ | ||
name: "should highlight block", | ||
async fn() { | ||
const code = 'var say = "Hello";'; | ||
const expected = | ||
'<span class="hljs-keyword">' + | ||
'var</span> say = <span class="hljs-string">' + | ||
'"Hello"</span>;'; | ||
|
||
const out = hljs.highlight(code, { language: "javascript" }); | ||
assertStrictEquals(out.value, expected); | ||
}, | ||
}); |