0

enter image description here

package.json

{
  "name": "application",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build ",
    "lint": "vue-cli-service lint",
    "dev": "vue-cli-service build --watch --mode=development",
    "test": "jest tests/.*test.ts",
    "watchTest": "jest --watch tests/.*test.ts"
  },
  "dependencies": {
    "@quasar/extras": "^1.6.4",
    "@types/node": "^14.0.3",
    "axios": "^0.19.2",
    "core-js": "^3.6.5",
    "quasar": "^1.0.0",
    "vue": "^2.6.11",
    "vue-browser-acl": "^0.13.5",
    "vue-class-component": "^7.2.3",
    "vue-i18n": "^8.16.0",
    "vue-infinite-loading": "^2.4.5",
    "vue-moment": "^4.1.0",
    "vue-property-decorator": "^8.4.2",
    "vue2-dropzone": "^3.6.0",
    "vuedraggable": "^2.23.2",
    "vuex": "latest",
    "vuex-class": "^0.3.2",
    "vuex-module-decorators": "^0.16.1",
    "vuex-persist": "^2.2.0"
  },
  "devDependencies": {
    "@types/jest": "^25.2.1",
    "@typescript-eslint/eslint-plugin": "^2.26.0",
    "@typescript-eslint/parser": "^2.26.0",
    "@vue/cli": "^4.3.1",
    "@vue/cli-plugin-babel": "~4.3.0",
    "@vue/cli-plugin-eslint": "~4.3.0",
    "@vue/cli-plugin-typescript": "^4.3.1",
    "@vue/cli-service": "^4.3.1",
    "@vue/eslint-config-typescript": "^5.0.2",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.0.1",
    "babel-plugin-transform-imports": "1.5.0",
    "clean-webpack-plugin": "^3.0.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "html-loader": "^1.1.0",
    "jest": "^26.0.1",
    "node-sass": "^4.13.0",
    "sass-loader": "^8.0.0",
    "typescript": "~3.8.3",
    "vue-cli-plugin-quasar": "~2.0.0",
    "vue-template-compiler": "^2.6.11",
    "webpack-assets-manifest": "^3.1.1"
  },
  "jest": {
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
      "\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
    }
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended",
      "@vue/typescript"
    ],
    "parserOptions": {
      "parser": "@typescript-eslint/parser"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

babel.config.js

module.exports = {
  "presets": [
    "@vue/cli-plugin-babel/preset"
  ],
  "plugins": [
    [
      "transform-imports",
      {
        "quasar": {
          "transform": "quasar/dist/babel-transforms/imports.js",
          "preventFullImport": true
        }
      }
    ],
  ]
}

tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "allowJs": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "jest",
      "node",
      "@types/jest"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

To be honest I even not sure what this error mean. Jest don't understand typeSript? Maybe vue? When I tried to find some answer in google, normally people have problem with "import" keywords, not some variable. I tried to add babel-plugin-proposal-class-properties, but it was worst. And because I even don't understand this error and can't find similar in net it's hard to do something. Maybe someone help.

1

1 Answer 1

1

Maybe you should install ts-jest

And add transform and moduleFileExtensions in package.json

{
  "jest": {
      "transform": {
        '^.+\\.ts?$': 'ts-jest',
        '.*\\.(vue)$': 'vue-jest'
      },
      "moduleFileExtensions": ['ts', 'js', 'vue']
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.