Skip to content

Commit

Permalink
[ONL-7918] fix unit test when using imported types for props
Browse files Browse the repository at this point in the history
  • Loading branch information
raulwwq0 committed Sep 21, 2023
1 parent c342988 commit 8cb54b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = {
],
rules: {
'import/first': 'off',
'chameleon/vue-props-interface': 'error',
// 'chameleon/vue-props-interface': 'error',

// to avoid "You have used a rule which requires parserServices to be generated." issues in vue files, we have to disable some
// typescript rules in vue files hoping that these bugs will be resolved one day:
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
errorOnDeprecated: true,
maxWorkers: '100%',
transform: {
'^.+\\.vue$': '@vue/vue3-jest',
'^.+\\.vue$': './vue3-jest.js',
'^.+\\.(j|t)sx?$': '@swc/jest',
},
transformIgnorePatterns: [
Expand Down
8 changes: 8 additions & 0 deletions vue3-jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// With Vue 3.3 we get the possibility to use imported types to declare props. However,
// this new method cause unit tests to fail due to the @vue/vue3-jest package didn't
// support it yet. This is a hacky fix that solves the issue.
// More info here: https://github.com/vuejs/core/issues/8301

/* eslint-disable import/no-extraneous-dependencies */
require('@vue/compiler-sfc').registerTS(require('typescript'));
module.exports = require('@vue/vue3-jest');

0 comments on commit 8cb54b6

Please sign in to comment.