Skip to content
Snippets Groups Projects
Commit b78b17c4 authored by sandcha's avatar sandcha
Browse files

Allow for and in script of test

Script is here a file that isn't a svelte component
Configuring tsconfig.js might not be compulsory
parent b9c46255
Branches
No related tags found
1 merge request!5Désactive le PLF 2022
......@@ -2,6 +2,25 @@
//https://kulshekhar.github.io/ts-jest/docs/getting-started/installation
export default {
preset: "ts-jest",
globals: {
"ts-jest": {
useESM: true,
},
},
moduleNameMapper: {
//"\\$lib/(.+)$": "<rootDir>/src/lib/$1",
//"\\$app/(.+)$": "<rootDir>/.svelte-kit/dev/runtime/app/$1",
//"^\\$lib(.*)$": "<rootDir>/src/lib$1",
//"^\\$app(.*)$": "<rootDir>/.svelte-kit/dev/runtime/app$1",
"^\\$lib(.*)$": "<rootDir>/src/lib$1",
"^\\$app(.*)$": [
"<rootDir>/.svelte-kit/dev/runtime/app$1",
"<rootDir>/.svelte-kit/build/runtime/app$1",
],
},
//https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
//preset: "ts-jest",
preset: "ts-jest/presets/default-esm",
testEnvironment: "node",
}
......@@ -27,5 +27,19 @@
"$lib/*": ["src/lib/*"]
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"],
/**
Setting a name mapper allow Jest tests written in TypeScript to know about $lib and $app.
*/
"moduleNameMapper": {
//"\\$lib/(.+)$": "<rootDir>/src/lib/$1",
//"\\$app/(.+)$": "<rootDir>/.svelte-kit/dev/runtime/app/$1",
//"^\\$lib(.*)$": "<rootDir>/src/lib$1",
//"^\\$app(.*)$": "<rootDir>/.svelte-kit/dev/runtime/app$1",
"^\\$lib(.*)$": "<rootDir>/src/lib$1",
"^\\$app(.*)$": [
"<rootDir>/.svelte-kit/dev/runtime/app$1",
"<rootDir>/.svelte-kit/build/runtime/app$1",
],
},
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment