Compare commits
3 commits
master
...
better-tes
Author | SHA1 | Date | |
---|---|---|---|
|
c4a4618840 | ||
|
74228f1fb3 | ||
|
f154303f76 |
4 changed files with 28 additions and 5 deletions
14
.github/workflows/node.js.yml
vendored
14
.github/workflows/node.js.yml
vendored
|
@ -17,6 +17,14 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: "npm"
|
||||
- run: npm install -f
|
||||
- run: npm run build
|
||||
- run: npm run test
|
||||
- name: Install dependencies
|
||||
run: npm install -f
|
||||
|
||||
- name: Build project
|
||||
run: npm run build
|
||||
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
.vscode
|
||||
node_modules
|
||||
lib
|
||||
coverage
|
|
@ -1,4 +1,8 @@
|
|||
const { defaults } = require("jest-config");
|
||||
|
||||
/** @type {import('@jest/types').Config.InitialOptions} */
|
||||
module.exports = () => ({
|
||||
preset: "ts-jest",
|
||||
moduleFileExtensions: [...defaults.moduleFileExtensions, "html"],
|
||||
collectCoverage: true,
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { existsSync, readdirSync, readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
import { format, Options } from "prettier";
|
||||
import { format, Options, ParserOptions } from "prettier";
|
||||
import * as jinjaPlugin from "../src/index";
|
||||
|
||||
const prettify = (code: string, options: Options) =>
|
||||
|
@ -42,3 +42,13 @@ tests.forEach((test) => {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
test("node has correct locStart and -End", () => {
|
||||
const plugin = jinjaPlugin.parsers["jinja-template"];
|
||||
|
||||
const ast = plugin.parse(`<p>{{ test }}</p>`, {}, {} as ParserOptions);
|
||||
const node = Object.values(ast.nodes)[0]!;
|
||||
|
||||
expect(plugin.locStart(node)).toEqual(3);
|
||||
expect(plugin.locEnd(node)).toEqual(13);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue