Converted specs to esm

This commit is contained in:
Alexander Cerutti
2025-01-11 16:39:37 +01:00
parent cbececb4f0
commit 3e5a70fc5b
4 changed files with 13 additions and 16 deletions

View File

@@ -4,9 +4,9 @@
* @type {import("jest").Config}
*/
module.exports = {
export default {
moduleFileExtensions: ["js", "mjs", "cjs"],
testEnvironment: "node",
testMatch: ["**/specs/**/*.spec.cjs"],
testMatch: ["**/specs/**/*.spec.mjs"],
injectGlobals: false,
};

View File

@@ -10,7 +10,7 @@
"build:dual": "pnpm tsconfig-to-dual-package tsconfig.esm.json tsconfig.cjs.json",
"build:all": "pnpm build && pnpm build:examples",
"prepublishOnly": "pnpm build && pnpm test",
"test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" pnpm jest -c jest.config.cjs --silent"
"test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" pnpm jest -c jest.config.mjs --silent"
},
"author": "Alexander Patrick Cerutti",
"license": "MIT",

View File

@@ -1,15 +1,12 @@
// @ts-check
const {
beforeEach,
beforeAll,
expect,
it,
describe,
} = require("@jest/globals");
const fs = require("node:fs");
const path = require("node:path");
const forge = require("node-forge");
const { default: PKPass } = require("../lib/PKPass");
import { beforeEach, beforeAll, expect, it, describe } from "@jest/globals";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import forge from "node-forge";
import { PKPass } from "passkit-generator";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* @returns {[cert: Buffer, key: Buffer]}

View File

@@ -1,5 +1,5 @@
const { describe, expect, it } = require("@jest/globals");
const { processDate, removeHidden } = require("../lib/utils");
import { describe, expect, it } from "@jest/globals";
import { processDate, removeHidden } from "../lib/esm/utils.js";
describe("Utils", () => {
describe("removeHidden", () => {