ModischFabrications / CutSolverFrontend

Simple frontend for CutSolver, a webservice to determine ideal cut placements
https://cutsolver.modisch.me
GNU General Public License v3.0
10 stars 2 forks source link

try unit tests #1

Closed ModischFabrications closed 4 years ago

ModischFabrications commented 4 years ago

Jest seems to be a nice one, although it is made by Facebook, wo also made React.

Vue says that it works 🤷‍♂

ModischFabrications commented 4 years ago

test access to env variables

ModischFabrications commented 4 years ago

https://medium.com/javascript-in-plain-english/add-test-coverage-to-vue-js-app-with-jest-travis-ci-and-coveralls-d10d118125c2

ModischFabrications commented 4 years ago
ModischFabrications commented 4 years ago

don't run jest directly, call from npm task: https://forum.vuejs.org/t/jest-throwing-syntaxerror-unexpected-token-import-on-new-vue-cli/35836/7

ModischFabrications commented 4 years ago
> cutsolver_frontend@0.3.0 test:unit D:\Kreativ\Programme\Vue\cutsolver_frontend
> vue-cli-service test:unit

 FAIL  tests/unit/app.spec.js
  ● Test suite failed to run

    D:\Kreativ\Programme\Vue\cutsolver_frontend\src\assets\content\about.md:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){## What is this?
                                                                                             ^

    SyntaxError: Invalid or unexpected token

      14 | 
      15 | <script>
    > 16 |     import about_file_content from "../assets/content/about.md";
         | ^
      17 | 
      18 |     export default {
      19 |         name: "About",

      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
      at src/components/ModalAbout.vue:16:1
      at Object.<anonymous> (src/components/ModalAbout.vue:36:3)