Update vitest (#2475)

* Update vitest

* Update vite test config

* Fix coverage metrics and bump coverage
This commit is contained in:
Dolan
2023-12-25 02:47:43 +00:00
committed by GitHub
parent 772fc8462a
commit c3080ff9d9
10 changed files with 549 additions and 2065 deletions

View File

@ -2,7 +2,7 @@ import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "../run/text-attributes";
import { IPageReferenceOptions } from "./pageref-properties";
import { IPageReferenceOptions } from "./pageref";
export class PageReferenceFieldInstruction extends XmlComponent {
public constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {

View File

@ -1,16 +0,0 @@
// Options according to https://www.ecma-international.org/publications/standards/Ecma-376.htm (at Part 1, Page 1234)
export interface IPageReferenceOptions {
/**
* \h option - Creates a hyperlink to the bookmarked paragraph.
*/
readonly hyperlink?: boolean;
/**
* \p option - Causes the field to display its position relative to the source
* bookmark. If the PAGEREF field is on the same page as the
* bookmark, it omits "on page #" and returns "above" or "below"
* only. If the PAGEREF field is not on the same page as the
* bookmark, the string "on page #" is used.
*/
readonly useRelativePosition?: boolean;
}

View File

@ -2,7 +2,22 @@
import { Begin, End } from "@file/paragraph/run/field";
import { Run } from "../run";
import { PageReferenceFieldInstruction } from "./pageref-field-instruction";
import type { IPageReferenceOptions } from "./pageref-properties";
// Options according to https://www.ecma-international.org/publications/standards/Ecma-376.htm (at Part 1, Page 1234)
export type IPageReferenceOptions = {
/**
* \h option - Creates a hyperlink to the bookmarked paragraph.
*/
readonly hyperlink?: boolean;
/**
* \p option - Causes the field to display its position relative to the source
* bookmark. If the PAGEREF field is on the same page as the
* bookmark, it omits "on page #" and returns "above" or "below"
* only. If the PAGEREF field is not on the same page as the
* bookmark, the string "on page #" is used.
*/
readonly useRelativePosition?: boolean;
};
export class PageReference extends Run {
public constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {

View File

@ -65,6 +65,8 @@ export class ImageRun extends Run {
.map((c) => c.charCodeAt(0)),
);
} else {
/* c8 ignore next 4 */
// Not possible to test this branch in NodeJS
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
const b = require("buf" + "fer");
return new b.Buffer(dataURI, "base64");