Configuration whit Jest



  • Someone using Jest for testing whit quasar?
    Can show it working whit quasar template from cli ?

    Tks a lot !



  •  export { QAjaxBar, QAlert, QAutocomplete, QBtn, QCard, QCardTitle, QCardMain, QCardActions, QCardMedia, QCardSeparator, QCarousel, QChatMessage, QCheckbox, QChip, QChipsInput, QCollapsible, QContextMenu, QDataTable, QDatetime, QDatetimeRange, QInlineDatetime, QFab, QFabAction, QField, QGallery, QGalleryCarousel, QIcon, QInfiniteScroll, QInnerLoading, QInput, QInputFrame, QKnob, QLayout, QFixedPosition, QSideLink, QItem, QItemSeparator, QItemMain, QItemSide, QItemTile, QItemWrapper, QList, QListHeader, QModal, QModalLayout, QResizeObservable, QScrollObservable, QWindowResizeObservable, QOptionGroup, QPagination, QParallax, QPopover, QProgress, QPullToRefresh, QRadio, QRange, QRating, QScrollArea, QSearch, QSelect, QDialogSelect, QSlideTransition, QSlider, QSpinner, audio as QSpinnerAudio, ball as QSpinnerBall, bars as QSpinnerBars, circles as QSpinnerCircles, comment as QSpinnerComment, cube as QSpinnerCube, dots
        SyntaxError: Unexpected token export
          at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
          at src/components/logo.vue:8:24
          at Object.<anonymous> (src/components/logo.vue:31:3)
    
    

    before include

       import { QBtn } from 'quasar-framework'
    

    tests works



  • This post is deleted!


  • Check this:
    https://github.com/paulvanbladel/quasar-jest
    In my opinion, it would make sense that jest is integrated in the base template of Quasar.



  • Tks @paul, i saw ur tests but, they working whitout any import of quasar.
    The problem is when import anything from quasar-framework.
    From the error i undertand : babel is transpiling my tests ( so i can es6 free in spesc.*) but not transpiling node_modules

    i’m using this config of jest

     "jest": {
        "verbose": false,
        "roots": [
          "<rootDir>/src"
        ],
        "moduleFileExtensions": [
          "js",
          "vue"
        ],
        "moduleDirectories": [
          "node_modules"
        ],
        "moduleNameMapper": {
          "src/components/([^\\.]*)$": "<rootDir>/src/components/$1.vue",
          "^vue$": "vue/dist/vue.common.js",
          "src/([^\\.]*)$": "<rootDir>/src/$1.vue",
          "(.*)/(.*)$": "$1/$2.vue"
        },
        "transform": {
          ".*\\.(vue)$": "<rootDir>/node_modules/jest-vue-preprocessor",
          ".*\\.(vue|js)$": "<rootDir>/node_modules/babel-jest"
        },
        "transformIgnorePatterns": [
          "node_modules/(?!vue-router)"
        ]
      }


  • Reading jest config, transform make the transpilations.
    But its not happing for node_modules imported depedencys



  • Btw, i aggre. If we get a mature config of Jest, it enter in quasar base template.



  • Yea. Importing the quasar.esm.js out of node_modules works perfect.
    Solving how to transpile node_modules and will post quasar + jest full conf.


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.