0

How to define describe(), it() and expect() in this Case ?? am getting the : No files found in C:\Users\tarek\Dogalu\dogalu_frontend_v2. Make sure Jest's configuration does not exclude this directory. To set up Jest, make sure a package.json file exists. Jest Documentation: facebook.github.io/jest/docs/configuration.html Files: "C:\Users\tarek\Dogalu\dogalu_frontend_v2\tests\unit\Gridcard.test.js"

[here is my Jest test, but I only get undefined functions.

here is my Jest test, but I only get undefined functions. I tried almost everything including npm install --g eslint npm install --g jest

this is my .eslintrc.js

module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/vue3-essential',
    '@vue/standard'
  ],
  parserOptions: {
    parser: 'babel-eslint'
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
  },
  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)'
      ],
      env: {
        jest: true
      }
    }
  ]

}

this is my package.json

  "name": "dogalu_frontend_v2",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "16.x",
    "npm": "8.x"
  },
  "scripts": {
    "start": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:unit": "vue-cli-service test:unit",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@pixi/filter-kawase-blur": "^4.1.5",
    "bootstrap": "^5.1.3",
    "bootstrap-icons": "^1.7.2",
    "boxicons": "^2.1.1",
    "core-js": "^3.6.5",
    "debounce": "^1.2.1",
    "hsl-to-hex": "^1.0.0",
    "pixi.js": "^6.2.0",
    "simplex-noise": "^3.0.0",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-unit-jest": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-standard": "^5.1.2",
    "@vue/test-utils": "^2.0.0-0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^7.0.0",
    "jest": "^25.5.4",
    "jest-fetch-mock": "^3.0.3",
    "supertest": "^6.1.6",
    "typescript": "~3.9.3",
    "vue-jest": "^5.0.0-0"
  }
}

so How can I define describe(), it() and expect() ?? And thanks in advance

law kira
  • 73
  • 4

1 Answers1

0

The solution was in naming the class Gridcard.spec.js instead of Gridcard.test.js

law kira
  • 73
  • 4
  • 1
    This solution does not make sense. Class names don't allow dots. And there is no class shown in the question. That looks more like a **filename**, but the only difference between the before and after is a space appended to the filename, which should also make no difference to the file system. – tony19 Dec 30 '21 at 19:39
  • 1
    Looks like .test.js was meant, wasn't it? – Estus Flask Dec 30 '21 at 19:56
  • @EstusFlask @tony19 exactly it was meant to ```Gridcard.spec.js``` instead of ```Gridcard.test.js``` – law kira Dec 30 '21 at 20:20
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 31 '21 at 00:14