Add typescript support to jest tests

This commit is contained in:
Ramon Wenger 2022-02-28 12:58:57 +01:00
parent 9e1ffbc710
commit 83b8b74c93
5 changed files with 36 additions and 1 deletions

View File

@ -1,5 +1,6 @@
{
"presets": [
"@babel/preset-typescript",
["@babel/preset-env", {
"useBuiltIns": false,
"targets": {

View File

@ -2,12 +2,14 @@ module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'ts',
'json',
'vue'
],
transform: {
"\\.(gql|graphql)$": "<rootDir>/node_modules/jest-transform-graphql",
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
"^.+\\.ts$": "<rootDir>/node_modules/babel-jest",
'^.+\\.vue$': '<rootDir>/node_modules/vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub'
},

View File

@ -726,6 +726,15 @@
"@babel/helper-plugin-utils": "^7.14.5"
}
},
"@babel/plugin-syntax-typescript": {
"version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.7.tgz",
"integrity": "sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.16.7"
}
},
"@babel/plugin-transform-arrow-functions": {
"version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz",
@ -1011,6 +1020,17 @@
"@babel/helper-plugin-utils": "^7.16.7"
}
},
"@babel/plugin-transform-typescript": {
"version": "7.16.8",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.8.tgz",
"integrity": "sha512-bHdQ9k7YpBDO2d0NVfkj51DpQcvwIzIusJ7mEUaMlbZq3Kt/U47j24inXZHQ5MDiYpCs+oZiwnXyKedE8+q7AQ==",
"dev": true,
"requires": {
"@babel/helper-create-class-features-plugin": "^7.16.7",
"@babel/helper-plugin-utils": "^7.16.7",
"@babel/plugin-syntax-typescript": "^7.16.7"
}
},
"@babel/plugin-transform-unicode-escapes": {
"version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz",
@ -1142,6 +1162,17 @@
"resolved": "https://registry.npmjs.org/@babel/preset-stage-2/-/preset-stage-2-7.8.3.tgz",
"integrity": "sha512-dStnEQgejNYIHFNACdDCigK4BF7wgW6Zahv9Dc2un7rGjbeVtZhBfR3sy0I7ZJOhBexkFxVdMZ5hqmll7BFShw=="
},
"@babel/preset-typescript": {
"version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz",
"integrity": "sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.16.7",
"@babel/helper-validator-option": "^7.16.7",
"@babel/plugin-transform-typescript": "^7.16.7"
}
},
"@babel/runtime": {
"version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",

View File

@ -119,6 +119,7 @@
"not ie <= 8"
],
"devDependencies": {
"@babel/preset-typescript": "^7.16.7",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"@vue/test-utils": "^1.3.0",

View File

@ -5,7 +5,7 @@ import {
removeAtIndex,
replaceAtIndex,
swapElements,
} from '@/graphql/immutable-operations';
} from '@/graphql/immutable-operations.ts';
describe('Cache operations', () => {
it('removes at index', () => {