Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Majestic is not loading next/jest + jest.config. #230

Open
HeinDiez opened this issue Mar 16, 2024 · 0 comments
Open

Majestic is not loading next/jest + jest.config. #230

HeinDiez opened this issue Mar 16, 2024 · 0 comments

Comments

@HeinDiez
Copy link

HeinDiez commented 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?

@HeinDiez HeinDiez changed the title Majestic is not loading next.js + jest.config that is using ES6 import/export. Majestic is not loading next/jest + jest.config that is using ES6 import/export. Mar 16, 2024
@HeinDiez HeinDiez changed the title Majestic is not loading next/jest + jest.config that is using ES6 import/export. Majestic is not loading next/jest + jest.config. Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant