Skip to content

Commit 843e81a

Browse files
committed
infrastructure configured
1 parent f069c54 commit 843e81a

14 files changed

+55
-44
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ module.exports = {
8282
files: ['**/*.ts'],
8383
parser: '@typescript-eslint/parser',
8484
parserOptions: {
85-
project: './tsconfig.json',
85+
project: [
86+
'./tsconfig.json',
87+
'./tests/tsconfig.json',
88+
],
8689
ecmaVersion: 2020,
8790
},
8891
"settings": {

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ fabric.properties
180180

181181
# JavaScript, TypeScript, NodeJS
182182
/dist
183+
/coverage
183184
/package-lock.json
184185
/node_modules
185186
*.tsbuildinfo

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add `api-entity-ref` to the plugins section of your `.eslintrc` configuration fi
3838
{
3939
"plugins": ["api-entity-ref"],
4040
"rules": {
41-
"api-entity-ref/decorator": "error"
41+
"api-entity-ref/check-class-decorator": "error"
4242
}
4343
}
4444
```
@@ -68,23 +68,23 @@ Or enable the ruleset via the `extends` property of your `.eslintrc` configurati
6868

6969
### How to make a build
7070

71-
`npm run build`
71+
`yarn run build`
7272

7373
### How to run lint
7474

75-
* Just show problems `npm run lint`
76-
* Fix problems if it is possible `npm run lint:fix`
75+
* Just show problems `yarn run lint`
76+
* Fix problems if it is possible `yarn run lint:fix`
7777

7878
### How to run tests
7979

8080
* All tests
8181

82-
`npm run test`
83-
`npm run test:watch`
82+
`yarn run test`
83+
`yarn run test:watch`
8484
* Specific tests
8585

86-
`npm run test -- src/my.spec.ts`
87-
`npm run test:watch -- src/my.spec.ts`
86+
`yarn run test -- src/my.spec.ts`
87+
`yarn run test:watch -- src/my.spec.ts`
8888

8989
## Author
9090

jest.config.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// For a detailed explanation regarding each configuration property, visit:
22
// https://jestjs.io/docs/en/configuration.html
33

4+
const toBoolean = value => (value === 'true' ? true : !!+value);
5+
46
module.exports = {
57
// All imported modules in your tests should be mocked automatically
68
// automock: false,
@@ -18,10 +20,10 @@ module.exports = {
1820
// clearMocks: false,
1921

2022
// Indicates whether the coverage information should be collected while executing the test
21-
// collectCoverage: false,
23+
collectCoverage: toBoolean(process.env.JEST_COLLECT_COVERAGE),
2224

2325
// An array of glob patterns indicating a set of files for which coverage information should be collected
24-
// collectCoverageFrom: null,
26+
collectCoverageFrom: ['src/**/*.ts'],
2527

2628
// The directory where Jest should output its coverage files
2729
// coverageDirectory: null,
@@ -32,12 +34,13 @@ module.exports = {
3234
// ],
3335

3436
// A list of reporter names that Jest uses when writing coverage reports
35-
// coverageReporters: [
37+
coverageReporters: [
3638
// "json",
3739
// "text",
38-
// "lcov",
40+
'lcov',
41+
'text-summary',
3942
// "clover"
40-
// ],
43+
],
4144

4245
// An object that configures minimum threshold enforcement for coverage results
4346
// coverageThreshold: null,
@@ -58,7 +61,11 @@ module.exports = {
5861
// globalTeardown: null,
5962

6063
// A set of global variables that need to be available in all test environments
61-
// globals: {},
64+
globals: {
65+
'ts-jest': {
66+
tsConfig: 'tests/tsconfig.json',
67+
},
68+
},
6269

6370
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
6471
// maxWorkers: "50%",
@@ -112,7 +119,7 @@ module.exports = {
112119
// restoreMocks: false,
113120

114121
// The root directory that Jest should scan for tests and modules within
115-
rootDir: 'src',
122+
// rootDir: 'src',
116123

117124
// A list of paths to directories that Jest should use to search for files in
118125
// roots: [
@@ -133,6 +140,7 @@ module.exports = {
133140

134141
// The test environment that will be used for testing
135142
// testEnvironment: "jest-environment-jsdom",
143+
testEnvironment: 'node',
136144

137145
// Options that will be passed to the testEnvironment
138146
// testEnvironmentOptions: {},

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"scripts": {
2121
"build": "rimraf dist && tsc -p tsconfig.build.json",
2222
"build:prod": "npm run build",
23-
"lint": "eslint --ext .js,.ts src/**",
23+
"lint": "eslint --ext .js,.ts ./{src,tests}/**/*.ts",
2424
"lint:fix": "npm run lint -- --fix",
2525
"pre-push": "npm run lint && npm run test && npm run build:prod && npm run tpl-repo:check",
2626
"preinstall": "node ./tools/check-yarn.js",
@@ -36,6 +36,7 @@
3636
"@babel/preset-env": "~7.7.6",
3737
"@babel/preset-typescript": "~7.7.4",
3838
"@types/jest": "~25.1.0",
39+
"@types/node": "^13.9.1",
3940
"@typescript-eslint/eslint-plugin": "~2.14.0",
4041
"@typescript-eslint/parser": "~2.14.0",
4142
"eslint": "~6.8.0",

src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export { rules } from './rules';
2+
export const configs = {
3+
ccc: 'ddd',
4+
};

src/my.spec.ts

-19
This file was deleted.

src/my.ts

-3
This file was deleted.
File renamed without changes.

src/rules/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const rules = {
2+
aaa: 'bbb',
3+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('check-class-decorator', () => {
2+
it('THEN: description ...', () => {
3+
expect(1).toBe(1);
4+
});
5+
});

tests/tsconfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"exclude": [ "node_modules", "dist" ],
3+
"include": [ "**/*.ts" ],
4+
"extends": "../tsconfig.json"
5+
}

tsconfig.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@
1313
"moduleResolution": "node",
1414
"noEmitHelpers": true,
1515
"removeComments": true,
16-
"sourceMap": true,
1716
"strict": true,
1817
"target": "es2019",
1918
"typeRoots": [
2019
"node_modules/@types"
2120
],
2221
"types": [
2322
"jest",
24-
"jest-extended"
23+
"jest-extended",
24+
"node"
2525
],
26-
"outDir": "./dist",
27-
"baseUrl": "./src",
28-
"rootDir": "./src"
26+
"outDir": "./dist"
2927
},
3028
"include": [
3129
"src/**/*.ts"

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,11 @@
10251025
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
10261026
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
10271027

1028+
"@types/node@^13.9.1":
1029+
version "13.9.1"
1030+
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.1.tgz#96f606f8cd67fb018847d9b61e93997dabdefc72"
1031+
integrity sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ==
1032+
10281033
"@types/normalize-package-data@^2.4.0":
10291034
version "2.4.0"
10301035
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"

0 commit comments

Comments
 (0)