Skip to content

Error on Import when Running CreateReactApp Test #164

@yuschick

Description

@yuschick

I have included Ally.js into a React/Redux/TypeScript project. Now, that I have made some good progress including it and getting it working I have hit an error when running yarn test before committing the updates. The error is as follows:

FAIL  src/containers/App/tests/index.test.tsx
 ● Test suite failed to run

   [path]/node_modules/ally.js/esm/maintain/disabled.js:21
   import nodeArray from '../util/node-array';
   ^^^^^^

   SyntaxError: Unexpected token import

     at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
     at Object.<anonymous> (src/components/RightSidebar/index.tsx:19:18)
     at Object.<anonymous> (src/components/Layout/index.tsx:6:22)

I have imported the components in from the ESM directory and added them to my types file for ActionScript.

declare module 'ally.js/esm/maintain/disabled';
declare module 'ally.js/esm/maintain/tab-focus';
declare module 'ally.js/esm/query/first-tabbable';
declare module 'ally.js/esm/when/key';

And inside my RightSidebar component I bring the components in with the following:

import AllyDisabled from 'ally.js/esm/maintain/disabled';
import AllyTabFocus from 'ally.js/esm/maintain/tab-focus';
import AllyKey from 'ally.js/esm/when/key';

Running this works fine as I've gotten the functionality to work. Only now when I run yarn test do I hit the error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions