Giter Club home page Giter Club logo

es-jest's Introduction

Hi there ๐Ÿ‘‹

es-jest's People

Contributors

ambar avatar dependabot[bot] avatar mlegenhausen avatar ohana54 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

es-jest's Issues

Compatibility with Jest 28

Hey there. Thanks for the module. I believe a small change might be needed for Jest 28 compatibility, as I'm getting the current error:

 FAIL  test/jest/module-a.spec.js
  โ— Test suite failed to run

    โ— Invalid return value:
      `process()` or/and `processAsync()` method of code transformer found at
      "/Users/erin/grit/github.com/make-files/makefiles/test/pkg-js/npm/node_modules/es-jest/transform.js"
      should return an object or a Promise resolving to an object. The object
      must have `code` property with a string of processed code.
      This error may be caused by a breaking change in Jest 28:
      https://jestjs.io/docs/upgrading-to-jest28#transformer
      Code Transformation Documentation:
      https://jestjs.io/docs/code-transformation


      at ScriptTransformer._buildTransformResult (node_modules/@jest/transform/build/ScriptTransformer.js:507:15)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:628:17)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:765:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:822:19)

Set esbuild as peer dependency

Could esbuild set as peerDependency instead of dependency? right now to be able to use it we need to use solutions like pnpm overrides to force it to use the latest version of esbuild, this would also overrule #1

and thank you @ambar this solution just works, since I've been trying to use another solutions to use esbuild with jest and this library just works flawlessly

jest.mock doesn't work with es-jest

As the title says, jest.mock doesn't work with es-jest. Adding above files in this repo and running the tests fail.
This totally blocks us. Can you please help?

// file myClass.ts
export default class MyClass {
    doSomething() {
        return 'foo'
    }
}
// file test/myClass.test.ts
import MyClass from '../myClass';
jest.mock('../myClass');

const MockedMyClass = jest.mocked(MyClass, true);

// fails here on TypeError: MockedMyClass.mockImplementation is not a function
MockedMyClass.mockImplementation(() => ({
  doSomething: () => 'bar',
}))

test('MyClass', () => {
  const myClass = new MyClass();
  expect(myClass.doSomething()).toEqual('bar')
})


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.