cc-archive / vocabulary-legacy

A cohesive design system & Vue component library to unify the web-facing Creative Commons

Home Page:https://cc-vocabulary.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restore project unit tests

brylie opened this issue · comments

Our project consists of three sub-modules:

  • fonts
  • vocabulary
  • vue-vocabulary

Each of the submodules used to have corresponding tests:

The unit tests were invoked in relevant continuous integration scripts:

Task

  • restore all testing code in a tests/ directory in the root of this project
    • tests/vue-vocabulary
  • ensure we have script(s) defined in package.json to invoke the test suites
    • test:vue-vocabulary
  • update CI test runners to invoke restored tests
    • ci-vue.yml (rename to ci-vue-vocabulary.yml)
  • remove fonts tests, since sass-jest is no longer maintained
    • delete vocabulary/.github/workflows/ci-fonts.yml
    • delete vocabulary/.github/workflows/ci-vocabulary.yml
  • delete all unused scripts and code after refactoring tests
"scripts": {
    "lint": "eslint src/*.js src/**/*.js tests/**/*.js",
    "test:unit": "jest -c tests/unit/jest.config.js",
    "test:snapshot": "jest -c tests/snapshot/jest.config.js",
    "build": "webpack --mode production",
    "watch": "webpack --mode production --watch --progress",
    "storybook": "start-storybook --ci -s ./src/assets -p 8080 --quiet",
    "build:documentation": "npm run build && build-storybook -s ./src/assets -o ./docs"
  },

This code snippet above is from the package.json file that had the scripts to run the test.
But if you notice, the test is run using a package configuration that is no longer used. jest

https://github.com/creativecommons/vocabulary/blob/5e7f4331d62267a4332da2ca484d29b0575e6007/packages/fonts/package.json

@brylie I think the last time the former deployment scripts were being used was when this other PR was made:
https://github.com/creativecommons/vocabulary/pull/906

@brylie I set up all these test independently on my local environment and discovered these test were removed because the package used for test is no longer maintained. There were a lot of bugs especially related to incompatibilities. I checked the repository for the test package used and also noticed an issue was raised there but has not been resolved. I think the package owner will not be pursuing it any longer.

so the most appropriate way forward will be to write new test or find a similar but current testing package.

Alright, we should remove the CI step for now then. Let's repurpose this task to disable the CI script.

Which package is no longer maintained? There seem to be at least a couple of test frameworks used in the files above, Vue tests, SCSS tests, and perhaps vanilla JS tests (via Jest).

Jest seems to be alive and well

https://jestjs.io/

Jest is the package that I think has the problem. These packages were provided by vue-cli-service but I think VueJS is now on v3 and that should explain

Yeah Jest is fine, but the test used a package known as sass-true which lets the sass files be tested via jest

OK, shall we deprecate the sass-true tests and keep the other Vue / JS tests then? I'd like to preserve some of the tests if possible.

It's this sass-true package that makes testing with jest and the sass files buggy now
oddbird/true#154

Yes I think we can keep the Vue/JS test alive.

So this issue is still very much valid

OK, great! I've updated the task checklist in the description to include "remove fonts tests" while restoring the other tests.

@brylie while going through the files I noticed the test for fonts and vocabulary was the same. So just the Vue-Vocabulary test is safe as of now.

So I want to request taking this issue to see how I can be able to rewrite some new test for the different packages.

The PR that may be as a result of this may also handle #962

@MuluhGodson, I've assigned you to the task. Thanks!