Skip to content

Commit

Permalink
test: Test environment can now run.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelketek committed Dec 7, 2023
1 parent 794ce89 commit 490ae6d
Show file tree
Hide file tree
Showing 6 changed files with 1,677 additions and 71 deletions.
2 changes: 1 addition & 1 deletion frontend/specs/App.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ describe('App.vue', () => {
const vm = wrapper.vm as any
await vm.$nextTick()
expect(vm.routeKey).toEqual('')
vm.$route.params.username = Bob
vm.$route.params.username = 'Bob'
expect(vm.routeKey).toEqual('username:Bob|')
vm.$route.params.characterName = 'Dude'
expect(vm.routeKey).toEqual('characterName:Dude|username:Bob|')
Expand Down
4 changes: 2 additions & 2 deletions frontend/specs/setupTestEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Polyfills the CSS.escape function, needed for dynamic CSS class/identifier creation.
require('css.escape')

export function testName() {
return expect.getState().currentTestName
export function testName(): string {
return expect.getState().currentTestName as string
}

export class LocalStorageMock {
Expand Down
15 changes: 6 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel",
moduleFileExtensions: [
'js',
'jsx',
Expand All @@ -9,7 +8,7 @@ module.exports = {
'tsx',
],
transform: {
'^.+\\.vue$': '@vue/vue2-jest',
'^.+\\.vue$': '@vue/vue3-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.tsx?$': 'ts-jest',
},
Expand All @@ -31,7 +30,10 @@ module.exports = {
testMatch: [
'**/specs/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
],
testURL: 'http://localhost/',
testEnvironment: 'jsdom',
testEnvironmentOptions: {
url: 'http://localhost/'
},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
Expand All @@ -42,10 +44,5 @@ module.exports = {
coveragePathIgnorePatterns: [
'/node_modules/',
'/specs/',
],
globals: {
'ts-jest': {
babelConfig: true,
},
},
]
}
Loading

0 comments on commit 490ae6d

Please sign in to comment.