01tek / ai-thing

ai-thing is a utility that allows you to create React components using natural language. Simply describe the layout, components, and styles you need, and ai-thing will generate the corresponding React code for you.
40 stars 3 forks source link

`npm run test` fails #8

Open ctsstc opened 1 month ago

ctsstc commented 1 month ago

I'm not certain how you're running the tests. Are you using a specific version of node? Are you utilizing specific flags to get it to run for ESM?

Error

╰─❯ npm run test                                                                                                                   ─╯

> ai-thing@1.0.2 test
> jest

 FAIL  tests/componentMapper.test.js
  ● Test suite failed to run

    Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

    By default "node_modules" folder is ignored by transformers.

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
     • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/configuration
    For information about custom transformations, see:
    https://jestjs.io/docs/code-transformation

    Details:

    /home/coder/projects/oss/ai-thing/tests/componentMapper.test.js:2
    import { parseDescription } from '../logic/nlpParser';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
x5engine commented 1 month ago

Yes, I didn't run the test last pr because of the fixes,

Bur there are other important things (we should be good at them) like dynamic import of design libraires that are not installed yet and should be tested somehow

x5engine commented 1 month ago

Anyway all your PRs have been merged