feat: fix up jest tests
This commit is contained in:
26
packages/hoppscotch-app/babel.config.js
Normal file
26
packages/hoppscotch-app/babel.config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
function isBabelLoader(caller) {
|
||||
return caller && caller.name === "babel-loader"
|
||||
}
|
||||
|
||||
module.exports = function (api) {
|
||||
if (api.env("test") && !api.caller(isBabelLoader)) {
|
||||
return {
|
||||
plugins: [
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
targets: {
|
||||
node: "current",
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export default function runTestScriptWithVariables(
|
||||
expect(value: any) {
|
||||
try {
|
||||
return expect(value, this._testReports)
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
pw._testReports.push({
|
||||
result: "ERROR",
|
||||
message: e.toString(),
|
||||
@@ -80,7 +80,7 @@ function test(
|
||||
_testReports.push({ startBlock: descriptor })
|
||||
try {
|
||||
func()
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
_testReports.push({ result: "ERROR", message: e, styles: styles.ERROR })
|
||||
}
|
||||
_testReports.push({ endBlock: true })
|
||||
|
||||
@@ -14,10 +14,6 @@ module.exports = {
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
|
||||
snapshotSerializers: ["jest-serializer-vue"],
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: [
|
||||
"<rootDir>/components/**/*.vue",
|
||||
"<rootDir>/pages/*.vue",
|
||||
],
|
||||
testURL: "http://localhost/",
|
||||
preset: "ts-jest/presets/js-with-babel",
|
||||
testEnvironment: "jsdom",
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"author": "Hoppscotch (support@hoppscotch.io)",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=14",
|
||||
"pnpm": ">=3"
|
||||
"node": ">=14",
|
||||
"pnpm": ">=3"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
@@ -36,6 +36,7 @@
|
||||
"ace-builds": "^1.4.12",
|
||||
"acorn": "^8.5.0",
|
||||
"acorn-walk": "^8.2.0",
|
||||
"axios": "^0.21.4",
|
||||
"core-js": "^3.17.2",
|
||||
"esprima": "^4.0.1",
|
||||
"firebase": "^9.0.1",
|
||||
@@ -65,10 +66,9 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.15.5",
|
||||
"@babel/preset-env": "^7.15.4",
|
||||
"@nuxt/types": "^2.15.8",
|
||||
"@commitlint/cli": "^13.1.0",
|
||||
"@commitlint/config-conventional": "^13.1.0",
|
||||
"lint-staged": "^11.1.2",
|
||||
"@nuxt/types": "^2.15.8",
|
||||
"@nuxt/typescript-build": "^2.1.0",
|
||||
"@nuxtjs/color-mode": "^2.1.1",
|
||||
"@nuxtjs/dotenv": "^1.4.1",
|
||||
@@ -93,6 +93,7 @@
|
||||
"eslint-plugin-vue": "^7.17.0",
|
||||
"jest": "^27.1.0",
|
||||
"jest-serializer-vue": "^2.0.2",
|
||||
"lint-staged": "^11.1.2",
|
||||
"nuxt-windicss": "^1.2.3",
|
||||
"prettier": "^2.3.2",
|
||||
"pretty-quick": "^3.1.1",
|
||||
|
||||
23
packages/hoppscotch-app/tsconfig.json
Normal file
23
packages/hoppscotch-app/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2018",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"lib": ["ESNext", "ESNext.AsyncIterable", "DOM"],
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": ["./*"],
|
||||
"@/*": ["./*"]
|
||||
},
|
||||
"types": ["@types/node", "@nuxt/types", "@nuxtjs/i18n", "@nuxtjs/toast", "unplugin-vue2-script-setup/types"]
|
||||
},
|
||||
"exclude": ["node_modules", ".nuxt", "dist"],
|
||||
"vueCompilerOptions": {
|
||||
"experimentalCompatMode": 2
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user