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

globalSetup file must export a function #8

Open
janmeier opened this issue Oct 13, 2020 · 2 comments
Open

globalSetup file must export a function #8

janmeier opened this issue Oct 13, 2020 · 2 comments

Comments

@janmeier
Copy link

I'm trying to switch out ts-jest with esbuild-jest, but I'm running into this error:

TypeError: globalSetup file must export a function at .../src/__tests__/globalSetup.ts

With the following jest config

module.exports = {
  projects: [{ 
    transform: {
      '.(ts|tsx)': 'esbuild-jest',
    },
    testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/node_modules/'],
    ...
  }],
  globalSetup: './/src/__tests__/globalSetup.ts',
}

I've dug up some old issues both in jest and ts-jest, but I haven't found the root cause of this kulshekhar/ts-jest#411, jestjs/jest#5164.

Deps:

"jest": "^26.5.3",
"esbuild-jest": "^0.2.2",
@aelbore
Copy link
Owner

aelbore commented Dec 3, 2020

@janmeier can you try the esbuild-jest@0.3.0 with esbuild@latest let me know if you still encounter the issue.

@janmeier
Copy link
Author

Hi Jay

Unfortunately we were stumped by another issue that's preventing us from using esbuild with jest. The way that esbuild exports modules makes them impossible to stub, so we are going withrthe regular tsc for our tests for now. Thanks for taking the time to look into this issue though

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

2 participants