aboutsummaryrefslogtreecommitdiff
path: root/jest.config.js
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-11-30 23:16:07 -0500
committerBobby <[email protected]>2022-11-30 23:16:07 -0500
commitdaaa789068cebb5fdfcea6197ade6e663be46e0f (patch)
tree1cd315851b779ac28fe622da332c3c16fe1c433c /jest.config.js
downloadtcssocialify-daaa789068cebb5fdfcea6197ade6e663be46e0f.tar.xz
tcssocialify-daaa789068cebb5fdfcea6197ade6e663be46e0f.zip
socialify update
Diffstat (limited to 'jest.config.js')
-rw-r--r--jest.config.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/jest.config.js b/jest.config.js
new file mode 100644
index 0000000..0a2bf78
--- /dev/null
+++ b/jest.config.js
@@ -0,0 +1,38 @@
+// jest.config.js
+const nextJest = require('next/jest')
+
+const createJestConfig = nextJest({
+ // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
+ dir: './'
+})
+
+// Add any custom config to be passed to Jest
+/** @type {import('jest').Config} */
+const customJestConfig = {
+ // Add more setup options before each test is run
+ // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
+ // if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
+ moduleDirectories: ['node_modules', '<rootDir>/'],
+ modulePathIgnorePatterns: ['<rootDir>/.vercel/'],
+ testEnvironment: 'jest-environment-jsdom',
+ collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts'],
+ testMatch: [
+ '<rootDir>/**/__tests__/**/*.{js,jsx,ts,tsx}',
+ '<rootDir>/**/*.{spec,test}.{js,jsx,ts,tsx}'
+ ],
+ moduleNameMapper: {
+ '\\.(css|less)$': 'identity-obj-proxy'
+ },
+ transformIgnorePatterns: [
+ '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$',
+ '^.+\\.module\\.(css|sass|scss)$'
+ ]
+ // "transform": {
+ // "^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
+ // "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
+ // "^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
+ // },
+}
+
+// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
+module.exports = createJestConfig(customJestConfig)