Skip to content

Commit f24894d

Browse files
committedJul 18, 2018
Initial commit
0 parents  commit f24894d

13 files changed

+183
-0
lines changed
 

‎.babelrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"presets": [
3+
"@babel/typescript",
4+
["@babel/env", { "target": { "node": "current" } }]
5+
],
6+
"env": {
7+
"coverage": {
8+
"plugins": ["istanbul"]
9+
}
10+
}
11+
}

‎.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
**/*.d.ts

‎.eslintrc.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
'root': true,
3+
4+
'parser': 'typescript-eslint-parser',
5+
6+
'plugins': [
7+
'typescript'
8+
],
9+
10+
'extends': [
11+
'@nighttrax'
12+
],
13+
14+
'settings': {
15+
'import/resolver': {
16+
'node': {
17+
'extensions': [
18+
'.js', '.ts'
19+
]
20+
},
21+
'babel-module': { }
22+
}
23+
},
24+
25+
'rules': {
26+
// ESLint doesn't understand interfaces yet and marks them as undefined.
27+
'no-undef': 0,
28+
29+
'typescript/no-unused-vars': 2
30+
}
31+
};

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
tests/results
4+
.nyc_output

‎.nycrc.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"include": [
3+
"src/**/*.ts"
4+
],
5+
"exclude": [
6+
"**/*.d.ts"
7+
],
8+
"extension": [".ts"],
9+
"all": true,
10+
11+
"sourceMap": false,
12+
"instrument": false,
13+
"require": [
14+
"./tests/register.ts"
15+
],
16+
17+
"reporter": ["html", "text"],
18+
"report-dir": "tests/results/coverage",
19+
20+
"lines": 100,
21+
"branches": 100,
22+
"check-coverage": true
23+
}

‎README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
> Create type safe mock React components to use in tests
2+
3+
## Usage
4+
5+
TODO

‎package.json

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "react-mock-component",
3+
"version": "0.0.1",
4+
"description": "Create type safe mock React components to use in tests",
5+
"keywords": [
6+
"tdd",
7+
"react",
8+
"spy",
9+
"stub",
10+
"mock",
11+
"test",
12+
"typescript"
13+
],
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/NiGhTTraX/react-mock-component.git"
17+
},
18+
"main": "dist/src/index",
19+
"types": "dist/src/index",
20+
"scripts": {
21+
"build": "npm run clean && npm run compile",
22+
"clean": "rm -rf ./dist",
23+
"compile": "tsc --declaration --outDir ./dist",
24+
"prepublishOnly": "npm run build",
25+
"lint": "eslint --ext ts .",
26+
"test": "TS_NODE_CACHE=0 mocha --opts tests/mocha.opts",
27+
"test:coverage": "NODE_ENV=coverage nyc mocha --opts tests/mocha.coverage.opts",
28+
"report-coverage": "nyc report --reporter=json && codecov -f tests/results/coverage/coverage-final.json",
29+
"precommit": "lint-staged"
30+
},
31+
"lint-staged": {
32+
"*.ts": "eslint"
33+
},
34+
"author": "Andrei Picus",
35+
"license": "MIT",
36+
"dependencies": {
37+
"chai": "~4.1.2"
38+
},
39+
"peerDependencies": {
40+
"typescript": "^2.8"
41+
},
42+
"devDependencies": {
43+
"@babel/core": "~7.0.0-beta.47",
44+
"@babel/preset-env": "~7.0.0-beta.47",
45+
"@babel/preset-typescript": "~7.0.0-beta.47",
46+
"@babel/register": "~7.0.0-beta.47",
47+
"@nighttrax/eslint-config": "~1.0.1",
48+
"@types/mocha": "~5.2.0",
49+
"@types/node": "~10.1.2",
50+
"babel-plugin-istanbul": "~4.1.6",
51+
"codecov": "~3.0.2",
52+
"eslint": "~4.19.1",
53+
"eslint-import-resolver-babel-module": "~4.0.0",
54+
"eslint-plugin-import": "~2.12.0",
55+
"eslint-plugin-jsx-a11y": "~6.0.3",
56+
"eslint-plugin-react": "~7.8.2",
57+
"eslint-plugin-typescript": "~0.12.0",
58+
"husky": "~0.14.3",
59+
"lint-staged": "~7.1.1",
60+
"mocha": "~5.2.0",
61+
"nyc": "~11.8.0",
62+
"ts-node": "~6.0.0",
63+
"typescript": "^2.8",
64+
"typescript-eslint-parser": "~15.0.0"
65+
},
66+
"files": [
67+
"dist/src/**/*"
68+
]
69+
}

‎src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default () => {};

‎tests/.eslintrc.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
'extends': '../.eslintrc.js',
3+
4+
'env': {
5+
'mocha': true
6+
},
7+
8+
'rules': {
9+
'func-names': 0,
10+
'no-unused-expressions': 0,
11+
'no-console': 0
12+
}
13+
};

‎tests/mocha.coverage.opts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests/**/*.spec.ts

‎tests/mocha.opts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--require ts-node/register
2+
tests/**/*.spec.{ts,tsx}

‎tests/register.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// There's no way to pass the `extensions` option via CLI.
2+
require('@babel/register')({
3+
extensions: ['.ts', '.js']
4+
});
5+

‎tsconfig.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es5",
5+
"lib": ["es6"],
6+
"sourceMap": true,
7+
"strict": true,
8+
"noUnusedParameters": false,
9+
"noUnusedLocals": false
10+
},
11+
"exclude": [
12+
"node_modules",
13+
"dist"
14+
]
15+
}

0 commit comments

Comments
 (0)
Please sign in to comment.