Skip to content

Commit 5a4f5aa

Browse files
committed
chore(Jest): Migrate from Mocha/Chai to Jest
1 parent e91cd9f commit 5a4f5aa

12 files changed

+843
-756
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"no-restricted-syntax": 0,
3131
},
3232
"env": {
33-
"mocha": true
33+
"jasmine": true,
34+
"jest": true
3435
},
3536
"globals": {
3637
"Class": true,

package.json

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"babel-eslint": "^7.2.3",
3232
"babel-plugin-transform-flow-strip-types": "^6.22.0",
3333
"babel-plugin-transform-object-rest-spread": "^6.23.0",
34-
"chai": "^4.0.1",
35-
"chai-as-promised": "6.0.0",
36-
"chai-spies": "0.7.1",
3734
"babel-preset-env": "^1.5.1",
3835
"cz-conventional-changelog": "^2.0.0",
3936
"eslint": "^3.19.0",
@@ -45,11 +42,9 @@
4542
"flow-bin": "^0.47.0",
4643
"graphql": "^0.10.1",
4744
"graphql-compose": "^1.19.4",
48-
"mocha": "^3.4.2",
49-
"nyc": "^10.3.2",
45+
"jest": "^20.0.4",
5046
"prettier": "^1.4.2",
5147
"rimraf": "^2.6.1",
52-
"sane": "^1.7.0",
5348
"semantic-release": "^6.3.2"
5449
},
5550
"dependencies": {},
@@ -58,26 +53,14 @@
5853
"path": "./node_modules/cz-conventional-changelog"
5954
}
6055
},
61-
"nyc": {
62-
"exclude": [
63-
"**/__mocks__/**",
64-
"**/__tests__/**",
65-
"resources",
66-
"node_modules"
67-
],
68-
"reporter": [
69-
"lcov",
70-
"text"
71-
]
72-
},
7356
"scripts": {
7457
"build": "npm run build-cjs && npm run build-flow",
7558
"build-cjs": "rimraf lib && babel src --ignore __tests__,__mocks__ -d lib",
7659
"build-flow": "find ./src -name '*.js' -not -path '*/__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/lib\\//g'`.flow; done",
77-
"coverage": "nyc npm run test",
60+
"coverage": "jest --coverage",
7861
"lint": "eslint src test *.js",
79-
"test": "babel-node ./node_modules/.bin/_mocha --compilers js:babel-core/register --reporter dot --require ./resources/mocha-bootload src/**/__tests__/**/*-test.js",
80-
"watch": "babel-node ./resources/watch.js",
62+
"test": "jest",
63+
"watch": "jest --watch",
8164
"link": "yarn build && yarn link graphql-compose && yarn link",
8265
"unlink": "yarn unlink graphql-compose && yarn add graphql-compose",
8366
"semantic-release": "semantic-release pre && npm publish && semantic-release post"

resources/mocha-bootload.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

resources/watch.js

Lines changed: 0 additions & 195 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`connectionResolver "Relay Cursor Connections Specification (Pagination algorithm)": ApplyCursorsToEdges(allEdges, before, after): should throw error if \`first\` is less than 0 1`] = `[Error: Argument \`first\` should be non-negative number.]`;
4+
5+
exports[`connectionResolver "Relay Cursor Connections Specification (Pagination algorithm)": ApplyCursorsToEdges(allEdges, before, after): should throw error if \`last\` is less than 0 1`] = `[Error: Argument \`last\` should be non-negative number.]`;
6+
7+
exports[`connectionResolver fallback logic (offset in cursor) should throw error if \`first\` is less than 0 1`] = `[Error: Argument \`first\` should be non-negative number.]`;
8+
9+
exports[`connectionResolver fallback logic (offset in cursor) should throw error if \`last\` is less than 0 1`] = `[Error: Argument \`last\` should be non-negative number.]`;

0 commit comments

Comments
 (0)