Skip to content

Commit 61263e1

Browse files
authored
[Feat] Configure the project (#1)
1 parent cbb4ddb commit 61263e1

File tree

11 files changed

+3407
-61
lines changed

11 files changed

+3407
-61
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+

.gitignore

Lines changed: 13 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,20 @@ coverage
2626
# nyc test coverage
2727
.nyc_output
2828

29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
29+
# artifacts
30+
build
31+
dist
4032

4133
# Dependency directories
4234
node_modules/
4335
jspm_packages/
4436

45-
# Snowpack dependency directory (https://snowpack.dev/)
46-
web_modules/
47-
4837
# TypeScript cache
4938
*.tsbuildinfo
5039

40+
# Rollup cache
41+
.rollup.cache
42+
5143
# Optional npm cache directory
5244
.npm
5345

@@ -57,12 +49,6 @@ web_modules/
5749
# Optional stylelint cache
5850
.stylelintcache
5951

60-
# Microbundle cache
61-
.rpt2_cache/
62-
.rts2_cache_cjs/
63-
.rts2_cache_es/
64-
.rts2_cache_umd/
65-
6652
# Optional REPL history
6753
.node_repl_history
6854

@@ -79,46 +65,6 @@ web_modules/
7965
.env.production.local
8066
.env.local
8167

82-
# parcel-bundler cache (https://parceljs.org/)
83-
.cache
84-
.parcel-cache
85-
86-
# Next.js build output
87-
.next
88-
out
89-
90-
# Nuxt.js build / generate output
91-
.nuxt
92-
dist
93-
94-
# Gatsby files
95-
.cache/
96-
# Comment in the public line in if your project uses Gatsby and not Next.js
97-
# https://nextjs.org/blog/next-9-1#public-directory-support
98-
# public
99-
100-
# vuepress build output
101-
.vuepress/dist
102-
103-
# vuepress v2.x temp and cache directory
104-
.temp
105-
.cache
106-
107-
# Docusaurus cache and generated files
108-
.docusaurus
109-
110-
# Serverless directories
111-
.serverless/
112-
113-
# FuseBox cache
114-
.fusebox/
115-
116-
# DynamoDB Local files
117-
.dynamodb/
118-
119-
# TernJS port file
120-
.tern-port
121-
12268
# Stores VSCode versions used for testing VSCode extensions
12369
.vscode-test
12470

@@ -128,3 +74,10 @@ dist
12874
.yarn/build-state.yml
12975
.yarn/install-state.gz
13076
.pnp.*
77+
78+
# Editors
79+
.idea
80+
.vscode
81+
82+
# misc
83+
.DS_Store

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"arrowParens": "avoid"
5+
}

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
# typescript-coverage
1+
# typescript-coverage
2+
3+
## Installation
4+
Install it alongside its peer dependencies (`chalk` and `glob`)
5+
6+
```bash
7+
npm install --save-dev typescript-coverage chalk glob
8+
```
9+
10+
```bash
11+
yarn add --dev typescript-coverage chalk glob
12+
```
13+
14+
```bash
15+
pnpm install --save-dev typescript-coverage chalk glob
16+
```
17+
18+
⚠️You will need node 20 and pnpm for local development

jest.config.mjs

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/**
2+
* For a detailed explanation regarding each configuration property, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
/** @type {import('jest').Config} */
7+
const config = {
8+
// All imported modules in your tests should be mocked automatically
9+
// automock: false,
10+
11+
// Stop running tests after `n` failures
12+
// bail: 0,
13+
14+
// The directory where Jest should store its cached dependency information
15+
// cacheDirectory: "/private/var/folders/gc/b9xb0z3d2db_wtz5303b6hyw0000gn/T/jest_dx",
16+
17+
// Automatically clear mock calls, instances, contexts and results before every test
18+
clearMocks: true,
19+
20+
// Indicates whether the coverage information should be collected while executing the test
21+
// collectCoverage: true,
22+
23+
// An array of glob patterns indicating a set of files for which coverage information should be collected
24+
// collectCoverageFrom: undefined,
25+
26+
// The directory where Jest should output its coverage files
27+
coverageDirectory: 'coverage',
28+
29+
// An array of regexp pattern strings used to skip coverage collection
30+
// coveragePathIgnorePatterns: [
31+
// "/node_modules/"
32+
// ],
33+
34+
// Indicates which provider should be used to instrument code for coverage
35+
coverageProvider: 'v8',
36+
37+
// A list of reporter names that Jest uses when writing coverage reports
38+
// coverageReporters: [
39+
// "json",
40+
// "text",
41+
// "lcov",
42+
// "clover"
43+
// ],
44+
45+
// An object that configures minimum threshold enforcement for coverage results
46+
// coverageThreshold: undefined,
47+
48+
// A path to a custom dependency extractor
49+
// dependencyExtractor: undefined,
50+
51+
// Make calling deprecated APIs throw helpful error messages
52+
// errorOnDeprecated: false,
53+
54+
// The default configuration for fake timers
55+
// fakeTimers: {
56+
// "enableGlobally": false
57+
// },
58+
59+
// Force coverage collection from ignored files using an array of glob patterns
60+
// forceCoverageMatch: [],
61+
62+
// A path to a module which exports an async function that is triggered once before all test suites
63+
// globalSetup: undefined,
64+
65+
// A path to a module which exports an async function that is triggered once after all test suites
66+
// globalTeardown: undefined,
67+
68+
// A set of global variables that need to be available in all test environments
69+
// globals: {},
70+
71+
// 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.
72+
// maxWorkers: "50%",
73+
74+
// An array of directory names to be searched recursively up from the requiring module's location
75+
// moduleDirectories: [
76+
// "node_modules"
77+
// ],
78+
79+
// An array of file extensions your modules use
80+
// moduleFileExtensions: [
81+
// "js",
82+
// "mjs",
83+
// "cjs",
84+
// "jsx",
85+
// "ts",
86+
// "tsx",
87+
// "json",
88+
// "node"
89+
// ],
90+
91+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
92+
// moduleNameMapper: {},
93+
94+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
95+
// modulePathIgnorePatterns: [],
96+
97+
// Activates notifications for test results
98+
// notify: false,
99+
100+
// An enum that specifies notification mode. Requires { notify: true }
101+
// notifyMode: "failure-change",
102+
103+
// A preset that is used as a base for Jest's configuration
104+
preset: 'ts-jest',
105+
106+
// Run tests from one or more projects
107+
// projects: undefined,
108+
109+
// Use this configuration option to add custom reporters to Jest
110+
// reporters: undefined,
111+
112+
// Automatically reset mock state before every test
113+
// resetMocks: false,
114+
115+
// Reset the module registry before running each individual test
116+
// resetModules: false,
117+
118+
// A path to a custom resolver
119+
// resolver: undefined,
120+
121+
// Automatically restore mock state and implementation before every test
122+
// restoreMocks: false,
123+
124+
// The root directory that Jest should scan for tests and modules within
125+
// rootDir: undefined,
126+
127+
// A list of paths to directories that Jest should use to search for files in
128+
// roots: [
129+
// "<rootDir>"
130+
// ],
131+
132+
// Allows you to use a custom runner instead of Jest's default test runner
133+
// runner: "jest-runner",
134+
135+
// The paths to modules that run some code to configure or set up the testing environment before each test
136+
// setupFiles: [],
137+
138+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
139+
// setupFilesAfterEnv: [],
140+
141+
// The number of seconds after which a test is considered as slow and reported as such in the results.
142+
// slowTestThreshold: 5,
143+
144+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
145+
// snapshotSerializers: [],
146+
147+
// The test environment that will be used for testing
148+
// testEnvironment: "jest-environment-node",
149+
150+
// Options that will be passed to the testEnvironment
151+
// testEnvironmentOptions: {},
152+
153+
// Adds a location field to test results
154+
// testLocationInResults: false,
155+
156+
// The glob patterns Jest uses to detect test files
157+
// testMatch: [
158+
// "**/__tests__/**/*.[jt]s?(x)",
159+
// "**/?(*.)+(spec|test).[tj]s?(x)"
160+
// ],
161+
162+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
163+
testPathIgnorePatterns: ['/node_modules/', 'dist', '.rollup.cache'],
164+
165+
// The regexp pattern or array of patterns that Jest uses to detect test files
166+
// testRegex: [],
167+
168+
// This option allows the use of a custom results processor
169+
// testResultsProcessor: undefined,
170+
171+
// This option allows use of a custom test runner
172+
// testRunner: "jest-circus/runner",
173+
174+
// A map from regular expressions to paths to transformers
175+
transform: {
176+
'.ts': [
177+
'ts-jest',
178+
{
179+
useESM: true,
180+
tsconfig: {
181+
verbatimModuleSyntax: false,
182+
},
183+
},
184+
],
185+
},
186+
187+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
188+
// transformIgnorePatterns: [
189+
// "/node_modules/",
190+
// "\\.pnp\\.[^\\/]+$"
191+
// ],
192+
193+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
194+
// unmockedModulePathPatterns: undefined,
195+
196+
// Indicates whether each individual test should be reported during the run
197+
// verbose: undefined,
198+
199+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
200+
// watchPathIgnorePatterns: [],
201+
202+
// Whether to use watchman for file crawling
203+
// watchman: true,
204+
};
205+
206+
export default config;

package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "typescript-coverage",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"main": "./dist/es/index.js",
6+
"types": "./dist/types/index.d.ts",
7+
"bin": {
8+
"typescript-coverage": "./dist/executable.js"
9+
},
10+
"description": "",
11+
"keywords": [],
12+
"author": "Dmitrii Novozhilov <dmitrii.novozhilov@prosehair.com>",
13+
"license": "MIT",
14+
"scripts": {
15+
"e2e": "pnpm build && ./dist/executable.js",
16+
"build": "rm -rf dist && pnpm type:generate && rollup -c",
17+
"postbuild": "chmod +x ./dist/executable.js",
18+
"type:generate": "tsc --project tsconfig.declarations.json",
19+
"type:check": "tsc --noEmit",
20+
"test": "jest",
21+
"test:coverage": "pnpm test -- --collectCoverage",
22+
"test:watch": "pnpm test -- --watch"
23+
},
24+
"devDependencies": {
25+
"@rollup/plugin-typescript": "^11.1.6",
26+
"@types/jest": "^29.5.12",
27+
"@types/node": "^20.14.10",
28+
"chalk": "^5.3.0",
29+
"glob": "^11.0.0",
30+
"jest": "^29.7.0",
31+
"prettier": "^3.3.3",
32+
"rollup": "^4.18.1",
33+
"ts-jest": "^29.2.3",
34+
"tslib": "^2.6.3",
35+
"typescript": "^5.5.3"
36+
},
37+
"peerDependencies": {
38+
"chalk": "^5.3.0",
39+
"glob": "^11.0.0"
40+
}
41+
}

0 commit comments

Comments
 (0)