Skip to content

Commit 9de0b0f

Browse files
committed
improve build files
1 parent bea1635 commit 9de0b0f

10 files changed

+5447
-11615
lines changed

.eslintrc.js

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,22 @@
11
module.exports = {
22
env: {
3-
jest: true,
43
browser: true,
54
es2021: true,
65
},
7-
plugins: ['@typescript-eslint', 'import'],
6+
plugins: ['@typescript-eslint'],
87
extends: [
98
'eslint:recommended',
109
'plugin:@typescript-eslint/eslint-recommended',
1110
'plugin:@typescript-eslint/recommended',
1211
'plugin:@typescript-eslint/recommended-requiring-type-checking',
13-
'plugin:import/errors',
14-
'plugin:import/warnings',
12+
'prettier',
1513
],
16-
settings: {
17-
'import/resolver': {
18-
node: {
19-
paths: ['src'],
20-
extensions: ['.js', '.ts'],
21-
},
22-
typescript: {
23-
paths: ['src'],
24-
extensions: ['.js', '.ts'],
25-
},
26-
},
27-
},
2814
parser: '@typescript-eslint/parser',
2915
parserOptions: {
3016
ecmaVersion: 'latest',
3117
sourceType: 'module',
3218
project: './tsconfig.json',
3319
},
34-
ignorePatterns: ['.eslintrc.js', 'webpack.config.js', 'babel.config.js', '*.spec.ts'],
3520
rules: {
3621
// sometimes we are sure it is not null
3722
'@typescript-eslint/no-non-null-assertion': 'off',

babel.config.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
module.exports = {
2-
presets: [
3-
['@babel/preset-env', {targets: {node: 'current'}}],
4-
'@babel/preset-typescript',
5-
],
2+
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
63
};

jest.config.mjs

+2-148
Original file line numberDiff line numberDiff line change
@@ -1,182 +1,36 @@
1-
/*
2-
* For a detailed explanation regarding each configuration property, visit:
3-
* https://jestjs.io/docs/configuration
4-
*/
5-
61
export default {
7-
// All imported modules in your tests should be mocked automatically
8-
// automock: false,
9-
10-
// Stop running tests after `n` failures
11-
// bail: 0,
12-
13-
// The directory where Jest should store its cached dependency information
14-
// cacheDirectory: "/private/var/folders/pm/36pkvkq543b8j0qb_mnsw58h0000gn/T/jest_dx",
15-
162
// Automatically clear mock calls and instances between every test
173
clearMocks: true,
184

195
// Indicates whether the coverage information should be collected while executing the test
206
collectCoverage: true,
217

22-
// An array of glob patterns indicating a set of files for which coverage information should be collected
23-
// collectCoverageFrom: undefined,
24-
258
// The directory where Jest should output its coverage files
269
coverageDirectory: 'coverage',
2710

28-
// An array of regexp pattern strings used to skip coverage collection
29-
// coveragePathIgnorePatterns: [
30-
// "/node_modules/"
31-
// ],
32-
3311
// Indicates which provider should be used to instrument code for coverage
3412
coverageProvider: 'v8',
3513

36-
// A list of reporter names that Jest uses when writing coverage reports
37-
// coverageReporters: [
38-
// "json",
39-
// "text",
40-
// "lcov",
41-
// "clover"
42-
// ],
43-
44-
// An object that configures minimum threshold enforcement for coverage results
45-
// coverageThreshold: undefined,
46-
47-
// A path to a custom dependency extractor
48-
// dependencyExtractor: undefined,
49-
5014
// Make calling deprecated APIs throw helpful error messages
51-
// errorOnDeprecated: false,
52-
53-
// Force coverage collection from ignored files using an array of glob patterns
54-
// forceCoverageMatch: [],
55-
56-
// A path to a module which exports an async function that is triggered once before all test suites
57-
// globalSetup: undefined,
58-
59-
// A path to a module which exports an async function that is triggered once after all test suites
60-
// globalTeardown: undefined,
61-
62-
// A set of global variables that need to be available in all test environments
63-
// globals: {},
64-
65-
// 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.
66-
// maxWorkers: "50%",
15+
errorOnDeprecated: true,
6716

6817
// An array of directory names to be searched recursively up from the requiring module's location
6918
moduleDirectories: ['node_modules'],
7019

7120
// An array of file extensions your modules use
7221
moduleFileExtensions: ['js', 'ts'],
7322

74-
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
75-
// moduleNameMapper: {},
76-
77-
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
78-
// modulePathIgnorePatterns: [],
79-
80-
// Activates notifications for test results
81-
// notify: false,
82-
83-
// An enum that specifies notification mode. Requires { notify: true }
84-
// notifyMode: "failure-change",
85-
86-
// A preset that is used as a base for Jest's configuration
87-
// preset: undefined,
88-
89-
// Run tests from one or more projects
90-
// projects: undefined,
91-
92-
// Use this configuration option to add custom reporters to Jest
93-
// reporters: undefined,
94-
95-
// Automatically reset mock state between every test
96-
// resetMocks: false,
97-
98-
// Reset the module registry before running each individual test
99-
// resetModules: false,
100-
101-
// A path to a custom resolver
102-
// resolver: undefined,
103-
104-
// Automatically restore mock state between every test
105-
// restoreMocks: false,
106-
107-
// The root directory that Jest should scan for tests and modules within
108-
// rootDir: undefined,
109-
11023
// A list of paths to directories that Jest should use to search for files in
11124
roots: ['<rootDir>'],
11225

113-
// Allows you to use a custom runner instead of Jest's default test runner
114-
// runner: "jest-runner",
115-
116-
// The paths to modules that run some code to configure or set up the testing environment before each test
117-
// setupFiles: [],
118-
119-
// A list of paths to modules that run some code to configure or set up the testing framework before each test
120-
// setupFilesAfterEnv: [],
121-
122-
// The number of seconds after which a test is considered as slow and reported as such in the results.
123-
// slowTestThreshold: 5,
124-
125-
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
126-
// snapshotSerializers: [],
127-
12826
// The test environment that will be used for testing
129-
testEnvironment: 'jsdom',
130-
131-
// Options that will be passed to the testEnvironment
132-
// testEnvironmentOptions: {},
133-
134-
// Adds a location field to test results
135-
// testLocationInResults: false,
27+
testEnvironment: '@happy-dom/jest-environment',
13628

13729
// The glob patterns Jest uses to detect test files
13830
testMatch: ['<rootDir>/src/**/?(*.)+(spec).[tj]s'],
13931

140-
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
141-
// testPathIgnorePatterns: [
142-
// "/node_modules/"
143-
// ],
144-
145-
// The regexp pattern or array of patterns that Jest uses to detect test files
146-
// testRegex: [],
147-
148-
// This option allows the use of a custom results processor
149-
// testResultsProcessor: undefined,
150-
151-
// This option allows use of a custom test runner
152-
// testRunner: "jest-circus/runner",
153-
154-
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
155-
// testURL: "http://localhost",
156-
157-
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
158-
// timers: "real",
159-
16032
// A map from regular expressions to paths to transformers
16133
transform: {
16234
'^.+\\.(js|ts)$': '<rootDir>/node_modules/babel-jest',
16335
},
164-
165-
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
166-
// transformIgnorePatterns: [
167-
// "/node_modules/",
168-
// "\\.pnp\\.[^\\/]+$"
169-
// ],
170-
171-
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
172-
// unmockedModulePathPatterns: undefined,
173-
174-
// Indicates whether each individual test should be reported during the run
175-
// verbose: undefined,
176-
177-
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
178-
// watchPathIgnorePatterns: [],
179-
180-
// Whether to use watchman for file crawling
181-
// watchman: true,
18236
};

0 commit comments

Comments
 (0)