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

No "exports" main defined in .../jest-puppeteer.json #528

Closed
yacineblr opened this issue Mar 6, 2023 · 1 comment Β· Fixed by #531
Closed

No "exports" main defined in .../jest-puppeteer.json #528

yacineblr opened this issue Mar 6, 2023 · 1 comment Β· Fixed by #531

Comments

@yacineblr
Copy link

yacineblr commented Mar 6, 2023

πŸ› Bug Report

Hi, I get an error when I try to import the presets.

● Validation Error:

  An unknown error occurred in ../../../../../jest.preset.js:

  No "exports" main defined in /Users/admin/Documents/custom_project/node_modules/jest-puppeteer/package.json
  Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/admin/Documents/custom_project/node_modules/jest-puppeteer/package.json
    at new NodeError (node:internal/errors:393:5)
    at exportsNotFound (node:internal/modules/esm/resolve:295:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:575:13)
    at resolveExports (node:internal/modules/cjs/loader:538:36)
    at Module._findPath (node:internal/modules/cjs/loader:607:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1025:27)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/admin/Documents/custom_project/jest.preset.js:3:19)

To Reproduce

Steps to reproduce the behavior:

file: jest.preset.js

const { merge } = require("lodash");
const nxPreset = require("@nrwl/jest/preset");
const puppeteer = require("jest-puppeteer");

module.exports = merge(nxPreset, puppeteer);

Do you know how I can solve my issue please, I feel like I am the only one with this issue

@ezzatron
Copy link

ezzatron commented Mar 7, 2023

I'm running into the same issue. I combine two Jest presets (jest-puppeteer and es-jest) which was working under version 7 but is broken under version 8 (see my combined preset):

import esPreset from "es-jest/jest-preset.js";
import puppeteerPreset from "jest-puppeteer/jest-preset.js";

export default {
  ...puppeteerPreset,
  ...esPreset,
};

This now results in the following error:

Package subpath './jest-preset.js' is not defined by "exports" in /path/to/github-release-action/github-release-action/node_modules/jest-puppeteer/package.json imported from /path/to/github-release-action/github-release-action/jest.preset.js

You can see this error on the GitHub Actions build from Dependabot attempting to bump jest-puppeteer on my repo: https://github.com/eloquent/github-release-action/actions/runs/4343222488/jobs/7585002111#step:5:12

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

Successfully merging a pull request may close this issue.

2 participants