Skip to content

Commit

Permalink
Modernize jest config and add mapper for jose
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardsph committed Jan 17, 2025
1 parent 91cc2ea commit 54d3a36
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//

import type { Config } from "jest";
import { createJsWithTsPreset, type JestConfigWithTsJest } from "ts-jest";

type ArrayElement<MyArray> = MyArray extends Array<infer T> ? T : never;

Expand All @@ -32,13 +33,19 @@ const baseConfig: ArrayElement<NonNullable<Config["projects"]>> = {
clearMocks: true,
injectGlobals: false,
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
moduleNameMapper: {
"^jose": require.resolve("jose"),
},
};

// Required by @peculiar/webcrypto, which comes from the polyfills
// loaded in the setup file.
process.env.OPENSSL_CONF = "/dev/null";

const config: Config = {
const presetConfig = createJsWithTsPreset({});

const config: JestConfigWithTsJest = {
...presetConfig,
reporters: ["default", "github-actions"],
collectCoverage: true,
coverageReporters: process.env.CI ? ["text", "lcov"] : ["text"],
Expand Down

0 comments on commit 54d3a36

Please sign in to comment.