web3-onboard icon indicating copy to clipboard operation
web3-onboard copied to clipboard

[Feature]: Transpile with babel

Open georgesmithishere opened this issue 2 years ago • 2 comments

Is your request related to a problem?

Hello and thank you for great library! not able to run a tests Screenshot 2022-09-07 at 15 10 51

Feature Description

maybe you could transpile assets with babel to get rid of ES6 syntax (which is not supported by Jest/NodeJS)

Alternative Solutions

No response

Anything else?

https://github.com/prepo-io/prepo-monorepo/tree/feat/onboard_wallets this is our public mono-repo steps to reproduce:

  1. go to /apps/frontend/core-dapp
  2. install dependencies yarn install
  3. and then yarn test

georgesmithishere avatar Sep 07 '22 12:09 georgesmithishere

Hey @georgesmithishere we're considering this and it's on our list - if you want to make sure it's in sooner than later we urge you to do a PR and add it in.

What is the build env you're using this with?

techgangboss avatar Sep 08 '22 21:09 techgangboss

@georgesmithishere could you try configuring your test env to use Babel?

lnbc1QWFyb24 avatar Sep 13 '22 01:09 lnbc1QWFyb24

Closing this issue for now, feel free to reopen if the above suggestion does not help.

lnbc1QWFyb24 avatar Sep 25 '22 23:09 lnbc1QWFyb24

Hello!

Is there any news about this? I'm getting also the same error as @georgesmithishere mentioned.

@aaronbarnardsound I tried the workaround you mentioned here but it's still not working: https://github.com/blocknative/web3-onboard/issues/1256#issuecomment-1244789235

carlosrsabreu avatar Nov 11 '22 11:11 carlosrsabreu

Hi! I'm also getting the same error when I'm trying to run jest. I tried the solution @aaronbarnardsound provided and it doesn't work either.

If you can provide any solution for this issue, I would really appreciate it.

my environment:

  • Next.js v12.1.0
  • React.js v17.0.0
  • Jest v27.5.1

my jest config:

const nextJest = require('next/jest');
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig.json');

const createJestConfig = nextJest({
  dir: './',
});

const customJestConfig = {
  setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
  moduleDirectories: ['node_modules', '<rootDir>/'],
  testEnvironment: 'jest-environment-jsdom',
  moduleNameMapper: {
    '^@/(.*)': '<rootDir>/$1',
  },
  testPathIgnorePatterns: ['/nodule_modules/'],
};

module.exports = createJestConfig(customJestConfig);

ChihYang41 avatar Nov 24 '22 10:11 ChihYang41

Any news on this? I've tried countless solutions, including @aaronbarnardsound , but to no avail.

carlos-menezes avatar Dec 05 '22 15:12 carlos-menezes

@aaronbarnardsound @techgangboss we are having the same issue running tests on Jest. It's possible to provide a transpile with babel?

Thanks

carlosfaria94 avatar Jan 06 '23 10:01 carlosfaria94