Majestic is not loading next/jest + jest.config.
Author: HeinDiezCreated Mar 16, 2024Updated Mar 16, 2024
Is this a bug report or a feature request?
Bug Report
Version Info
- Version of Majestic: v1.8.1
- Version of Jest: v29.7.0
- Version of Node: v18.17.1
- Operating System: Windows 10 - 64
Reproduction Repo
The application I am working on is based around Next.js with a jest.js configuration. To make jest work, next provide a 'next/jest.js' config provider to make jest know how to transpile the code.
jest.config.js
const nextJest = require('next/jest')
/** @type {import('jest').Config} */
const createJestConfig = nextJest({
dir: './'
})
const config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
testMatch: ['**/__test__/*.(spec|test).?(c|m)[tj]s?(x)']
}
module.exports = createJestConfig(config)
package.json
"majestic": {
"jestScriptPath": "./node_modules/jest/bin/jest.js",
"args": [
"--config=./jest.config.js"
]
}but when I run 'majestic'. I am greeted with an error:
i Error occured while obtaining Jest cofiguration for coverage report SyntaxError: Unexpected token i in JSON at position 0
is there a workaround to this?
Source: Raathigesh/majestic