Skip to content

Commit

Permalink
setup unit test jest
Browse files Browse the repository at this point in the history
  • Loading branch information
vallemar committed Dec 1, 2021
1 parent 1cc7431 commit d710dc8
Show file tree
Hide file tree
Showing 10 changed files with 19,678 additions and 6,679 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
["env", { "modules": false }]

],
"env": {
"test": {
"presets": [
["env", { "targets": { "node": "current" }}]
]
}
}
}
3 changes: 1 addition & 2 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ if (isAndroid) {
}

/* CONFIG NS-VUE */
declare let __DEV__: boolean;
Vue.config.silent = !__DEV__;
Vue.config.silent = false;
Vue.config.suppressRenderLogs = true;

/* REGISTER ELEMENTS */
Expand Down
12 changes: 6 additions & 6 deletions app/components/NSButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<AbsoluteLayout @tap="!disabled ? $emit('tap') : ''">
<AbsoluteLayout id="ns-button" @tap="!disabled ? $emit('tap') : ''">
<FlexboxLayout
:disabled="disabled"
:class="[background]"
Expand All @@ -26,11 +26,11 @@
</FlexboxLayout>
</AbsoluteLayout>
</template>
<script lang="ts">
import Vue from "nativescript-vue";
import Loading from "~/components/Loading.vue";
<script>
import Loading from "~/components/Loading";
export default {
export default Vue.extend({
name: "NSButton",
components: { Loading },
props: {
Expand Down Expand Up @@ -65,7 +65,7 @@ export default {
return this.primary ? "bg-primary" : "";
},
},
};
});
</script>

<style></style>
22 changes: 22 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
verbose: true,
moduleFileExtensions: ["ts", "js", "json", "vue"],
transform: {
".*\\.(vue)$": "@vue/vue2-jest",
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
"^.+\\.tsx?$": "ts-jest",
},
moduleNameMapper: {
"^@/(.*)": "<rootDir>/app/$1",
"^~/(.*)": "<rootDir>/app/$1",
},
roots: ["<rootDir>/tests/"],
testEnvironment: "jsdom",
setupFiles: ["<rootDir>/tests/setup.ts"],
};

/* collectCoverage: false,
collectCoverageFrom: ["app/!**!/!*.{js,vue,ts}", "!**!/node_modules/!**"],
coverageReporters: ["html", "text-summary"],*/
/* preset: "ts-jest/presets/js-with-ts",
transformIgnorePatterns: ["node_modules/(?!(bootstrap-vue)/)"],*/
Loading

0 comments on commit d710dc8

Please sign in to comment.