mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
23 lines
739 B
JavaScript
23 lines
739 B
JavaScript
const hq = require("alias-hq");
|
|
|
|
/** @type { (dirname: string) => import('@jest/types').Config.InitialOptions } */
|
|
module.exports.makePackageConfig = (dirname) => {
|
|
const packageJson = require(dirname + "/package.json");
|
|
const packageBaseName = packageJson.name.replace("@jspsych/", "");
|
|
|
|
return {
|
|
transform: { "\\.(js|jsx|ts|tsx)$": "@sucrase/jest-plugin" },
|
|
moduleNameMapper: hq.load(dirname + "/tsconfig.json").get("jest"),
|
|
testEnvironment: "jsdom",
|
|
testEnvironmentOptions: {
|
|
fetchExternalResources: true,
|
|
pretendToBeVisual: true,
|
|
url: "http://localhost/",
|
|
},
|
|
displayName: {
|
|
name: packageBaseName,
|
|
color: packageBaseName === "jspsych" ? "white" : "cyanBright",
|
|
},
|
|
};
|
|
};
|