buttons / react-github-btn

:octocat: Unofficial github:button component for React.js
https://buttons.github.io
BSD 2-Clause "Simplified" License
62 stars 8 forks source link

Jest is failing when using GitHub Button #12

Closed hhimanshu closed 3 years ago

hhimanshu commented 3 years ago

Hello,

Here is the failing test https://github.com/hhimanshu/create-react-ts-starter/pull/25/checks?check_run_id=2993024014#step:4:8

Jest is complaining as below

/home/runner/work/create-react-ts-starter/create-react-ts-starter/node_modules/react-github-btn/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React, { PureComponent } from 'react'
                                                                                             ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      1 | import React from 'react';
    > 2 | import GitHubButton from 'react-github-btn';
        | ^
      3 | import './styles.css';
      4 |
      5 | export const Header = () => {

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)

Do you know what's going wrong and how to fix it?

Thanks

ntkme commented 3 years ago

This is the same issue as #10, see https://github.com/ntkme/react-github-btn/issues/10#issuecomment-799171378.