Merge pull request #11 from Kugelschieber/test-setup

Test Framework
This commit is contained in:
Daniel Schramm
2020-12-15 20:37:47 +01:00
committed by GitHub
5 changed files with 5503 additions and 1155 deletions

View File

@@ -2,15 +2,19 @@
A browser game inspired by Breach Protocol from Cyberpunk 2077. A browser game inspired by Breach Protocol from Cyberpunk 2077.
## Run in development mode ## Building the project
``` ```
// run once to install all dependencies
npm i
// run all tests
npm run test
// run the server for local development
npm run serve npm run serve
```
### Build for production // build for production
```
npm run build npm run build
``` ```

6584
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,23 +5,42 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint",
"test": "jest"
},
"jest": {
"moduleFileExtensions": [
"js",
"ts",
"json",
"vue"
],
"transform": {
".*\\.(vue)$": "vue-jest",
"^.+\\.tsx?$": "ts-jest"
},
"testURL": "http://localhost/"
}, },
"dependencies": { "dependencies": {
"vue": "^3.0.0" "vue": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.33.0", "@types/jest": "^26.0.19",
"@typescript-eslint/parser": "^2.33.0", "@typescript-eslint/eslint-plugin": "^4.10.0",
"@vue/cli-plugin-eslint": "~4.5.0", "@typescript-eslint/parser": "^4.10.0",
"@vue/cli-plugin-typescript": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.9",
"@vue/cli-service": "~4.5.0", "@vue/cli-plugin-typescript": "~4.5.9",
"@vue/compiler-sfc": "^3.0.0", "@vue/cli-service": "~4.5.9",
"@vue/eslint-config-typescript": "^5.0.2", "@vue/compiler-sfc": "^3.0.4",
"eslint": "^6.7.2", "@vue/eslint-config-typescript": "^7.0.0",
"eslint-plugin-vue": "^7.0.0-0", "@vue/test-utils": "^2.0.0-beta.12",
"eslint": "^7.15.0",
"eslint-plugin-vue": "^7.2.0",
"jest": "^26.6.3",
"node-sass": "^5.0.0", "node-sass": "^5.0.0",
"sass-loader": "^10.1.0", "sass-loader": "^10.1.0",
"typescript": "~3.9.3" "ts-jest": "^26.4.4",
"typescript": "~4.1.3",
"vue-jest": "^5.0.0-alpha.7"
} }
} }

View File

@@ -0,0 +1,16 @@
import "jest";
import {shallowMount} from "@vue/test-utils";
import HelloWorld from "../components/HelloWorld.vue";
describe("HelloWorld.vue", () => {
test("renders props.msg when passed", () => {
const msg = "new message"
const wrapper = shallowMount(HelloWorld, {
propsData: {
msg
}
});
expect(wrapper.text()).toMatch(msg)
});
});

View File

@@ -12,7 +12,8 @@
"sourceMap": true, "sourceMap": true,
"baseUrl": ".", "baseUrl": ".",
"types": [ "types": [
"webpack-env" "webpack-env",
"jest"
], ],
"paths": { "paths": {
"@/*": [ "@/*": [