Skip to content

Commit

Permalink
Adding Istanbul test coverage (gothinkster#184)
Browse files Browse the repository at this point in the history
* adding istanbul

* Delete yarn.lock

* Delete package-lock.json

* remove coverage file

* add back testURL

* changed readme command

* babel config

* changes to babel config
  • Loading branch information
emmabel96 authored and igeligel committed Aug 26, 2019
1 parent cc0597a commit 2ce2771
Show file tree
Hide file tree
Showing 6 changed files with 1,811 additions and 2,274 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Other commands available are:
yarn run build

# run unit tests
yarn run test:unit
yarn test
```

## To know
Expand Down
9 changes: 8 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
module.exports = {
presets: ["@vue/app"]
env: {
dev: {
presets: ["@vue/app"]
},
test: {
presets: ["@babel/preset-env"]
}
}
};
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ module.exports = {
"^.+\\.vue$": "vue-jest",
".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$":
"jest-transform-stub",
"^.+\\.jsx?$": "babel-jest"
"^.+\\.(js|jsx)?$": "babel-jest"
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1"
},
snapshotSerializers: ["jest-serializer-vue"],
testMatch: [
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
"<rootDir>/(tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx))"
],
testURL: "http://localhost/"
testURL: "http://localhost/",
transformIgnorePatterns: ["<rootDir>/node_modules/"]
};
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
},
"description": "TodoMVC for the RealWorld™",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@vue/cli-plugin-babel": "^3.10.0",
"@vue/cli-plugin-eslint": "^3.10.0",
"@vue/cli-plugin-pwa": "^3.10.0",
Expand All @@ -23,6 +25,7 @@
"babel-jest": "^24.9.0",
"lint-staged": "^8.2.1",
"node-sass": "^4.12.0",
"nyc": "^14.1.1",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.6.10"
},
Expand All @@ -41,10 +44,10 @@
},
"name": "realworld-vue",
"scripts": {
"build": "vue-cli-service build",
"build": "BABEL_ENV=dev vue-cli-service build",
"lint": "vue-cli-service lint",
"serve": "vue-cli-service serve",
"test:unit": "vue-cli-service test:unit"
"serve": "BABEL_ENV=dev vue-cli-service serve",
"test": "BABEL_ENV=test jest --coverage"
},
"version": "0.1.0"
}
4 changes: 2 additions & 2 deletions tests/unit/store/article.module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe("Vuex Article Module", () => {
const context = { commit: commitFunction };
const payload = "5611ee1b-0b95-417f-a917-86687176a627";
await actions[FAVORITE_ADD](context, payload);
expect(commitFunction.mock.calls[0][0]).toBe("updateAricleInList");
expect(commitFunction.mock.calls[0][0]).toBe("updateArticleInList");
expect(commitFunction.mock.calls[0][1]).toEqual({
author: {},
title: "Lorem ipsum dolor sit amet",
Expand Down Expand Up @@ -229,7 +229,7 @@ describe("Vuex Article Module", () => {
const context = { commit: commitFunction };
const payload = "480fdaf8-027c-43b1-8952-8403f90dcdab";
await actions[FAVORITE_REMOVE](context, payload);
expect(commitFunction.mock.calls[0][0]).toBe("updateAricleInList");
expect(commitFunction.mock.calls[0][0]).toBe("updateArticleInList");
expect(commitFunction.mock.calls[0][1]).toEqual({
author: {},
title: "Lorem ipsum dolor sit amet",
Expand Down
Loading

0 comments on commit 2ce2771

Please sign in to comment.