Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm test fail with SyntaxError #10

Closed
baldoalessandro opened this issue Feb 26, 2020 · 7 comments
Closed

npm test fail with SyntaxError #10

baldoalessandro opened this issue Feb 26, 2020 · 7 comments

Comments

@baldoalessandro
Copy link

 Details:

    /home/ale-td/Documents/oss/open-hospital/openhospital-ui/node_modules/react-day-picker/lib/style.css:3
    .DayPicker {
    ^

    SyntaxError: Unexpected token .

      15 | import * as React from "react";
      16 | import DayPicker from "react-day-picker";
    > 17 | import "react-day-picker/lib/style.css";
         | ^
      18 | import { Link as LinkRouter } from "react-router-dom";
      19 | import styles from "./Calendario.style";
      20 | import ExpandMore from "@material-ui/icons/ExpandMore";

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:440:17)
      at Object.<anonymous> (src/components/calendar/Calendario.tsx:17:1)
      at Object.<anonymous> (src/routes.tsx:17:1)
@baldoalessandro
Copy link
Author

@AceGentile
Copy link

@baldoalessandro non è che jest non sa come gestirsi i css e va settato il moduleNameMapper facendogli gestire il css?

@baldoalessandro
Copy link
Author

si può essere stavo provando pure quello, ma faccio il mock dei moduli css?

@AceGentile
Copy link

Dunque ci sono un po' di casini tutti insieme:

  • setupTestFrameworkScriptFile è stato deprecato e sostituito da setupFilesAfterEnv
  • vanno settati i moduleNameMapper, soprattutto per il css
  • "Version 24.1.0 of jest installed has not been tested with ts-jest"

@baldoalessandro
Copy link
Author

Ho provato questo ma niente: jestjs/jest#3094 (comment)

@baldoalessandro
Copy link
Author

Provato con 1, 2 (jestjs/jest#3094 (comment)) e 3 (v 23.6.0) senza successo.

@AceGentile
Copy link

A quanto pare non c'erano solo quelle cose ma richiedeva anche altri fix per funzionare:

informatici/openhospital-ui#14

@xrmx xrmx closed this as completed Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants