Skip to content

Commit

Permalink
1) Migrate from vuex to pinia.
Browse files Browse the repository at this point in the history
2) Add tests for all components, store and router.
3) Port `CelebrityGuess` to use `WinnerCard`, `LoserCard` and
`GameSlide`.
4) Delete unused `About.vue`.
5) Added mocks for WebAudio API for tests.
6) Upgrade to latest `vue/test-utils`.
7) Added coverage to tests (now up to 95%!).
8) Migrate off of `vue-cli` test related stuff to straight `jest` with
`babel`.
  • Loading branch information
RobSpectre committed Apr 13, 2022
1 parent ac2568c commit fe2adc7
Show file tree
Hide file tree
Showing 36 changed files with 1,755 additions and 2,363 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/test-utils.js
13 changes: 12 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest',
moduleFileExtensions: ['vue', 'js', 'json', 'jsx', 'ts', 'tsx', 'node'],
transform: {
'^.+\\.vue$': '@vue/vue3-jest',
'^.+\\js$': 'babel-jest'
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
testEnvironment: 'jsdom',
setupFiles: [
'./tests/setupTests.js'
],
setupFilesAfterEnv: [
'<rootDir>/jest.setup.js'
],
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.{js,vue}',
Expand Down
8 changes: 8 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mocks } from './tests/test-utils'

// Audio mock
/* eslint no-undef: "off" */
global.Audio = jest.fn().mockImplementation(() => ({
pause: mocks.Audio.pause,
play: mocks.Audio.play
}))
Loading

0 comments on commit fe2adc7

Please sign in to comment.