Skip to content

Commit 8949fad

Browse files
authored
Merge pull request #1886 from usablica/typescript
Move to Typescript
2 parents 81f8efb + 7946801 commit 8949fad

File tree

108 files changed

+9384
-11169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+9384
-11169
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ on: [push]
55
jobs:
66
build:
77

8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99

1010
strategy:
1111
matrix:
12-
node-version: [12.x, 13.x, 14.x, 16.x]
12+
node-version: [14.x, 16.x]
1313

1414
steps:
1515
- uses: actions/checkout@v2

babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
}
1010
},
1111
"presets": [
12+
["@babel/preset-typescript", {}],
1213
[
1314
"@babel/env",
1415
{

jest.config.js

Lines changed: 19 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,23 @@
1-
/*
2-
* For a detailed explanation regarding each configuration property, visit:
3-
* https://jestjs.io/docs/en/configuration.html
4-
*/
5-
61
module.exports = {
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: "/tmp/jest_rs",
15-
16-
// Automatically clear mock calls and instances between every test
2+
testEnvironment: 'node',
173
clearMocks: true,
18-
19-
// Indicates whether the coverage information should be collected while executing the test
20-
// collectCoverage: false,
21-
22-
// An array of glob patterns indicating a set of files for which coverage information should be collected
23-
// collectCoverageFrom: undefined,
24-
25-
// The directory where Jest should output its coverage files
26-
coverageDirectory: "coverage",
27-
28-
// An array of regexp pattern strings used to skip coverage collection
29-
// coveragePathIgnorePatterns: [
30-
// "/node_modules/"
31-
// ],
32-
33-
// Indicates which provider should be used to instrument code for coverage
34-
// coverageProvider: "babel",
35-
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-
50-
// 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%",
67-
68-
// An array of directory names to be searched recursively up from the requiring module's location
69-
// moduleDirectories: [
70-
// "node_modules"
71-
// ],
72-
73-
// An array of file extensions your modules use
74-
moduleFileExtensions: [
75-
"js"
4+
setupFilesAfterEnv: ["jest-extended/all"],
5+
roots: ["<rootDir>/tests/jest"],
6+
transform: {
7+
'^.+\\.tsx?$': ['ts-jest', {
8+
...require('./tsconfig.test.json')
9+
}],
10+
},
11+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
12+
setupFiles: ['<rootDir>/tests/jest/setup.ts'],
13+
moduleNameMapper: {
14+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
15+
},
16+
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.(ts|js)x?$',
17+
coverageDirectory: 'coverage',
18+
collectCoverageFrom: [
19+
'src/**/*.{ts,tsx,js,jsx}',
20+
'!src/**/*.d.ts',
21+
'!src/**/*.test.ts',
7622
],
77-
78-
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
79-
// moduleNameMapper: {},
80-
81-
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
82-
// modulePathIgnorePatterns: [],
83-
84-
// Activates notifications for test results
85-
// notify: false,
86-
87-
// An enum that specifies notification mode. Requires { notify: true }
88-
// notifyMode: "failure-change",
89-
90-
// A preset that is used as a base for Jest's configuration
91-
// preset: undefined,
92-
93-
// Run tests from one or more projects
94-
// projects: undefined,
95-
96-
// Use this configuration option to add custom reporters to Jest
97-
// reporters: undefined,
98-
99-
// Automatically reset mock state between every test
100-
// resetMocks: false,
101-
102-
// Reset the module registry before running each individual test
103-
// resetModules: false,
104-
105-
// A path to a custom resolver
106-
// resolver: undefined,
107-
108-
// Automatically restore mock state between every test
109-
// restoreMocks: false,
110-
111-
// The root directory that Jest should scan for tests and modules within
112-
// rootDir: undefined,
113-
114-
// A list of paths to directories that Jest should use to search for files in
115-
// roots: [
116-
// "<rootDir>"
117-
// ],
118-
119-
// Allows you to use a custom runner instead of Jest's default test runner
120-
// runner: "jest-runner",
121-
122-
// The paths to modules that run some code to configure or set up the testing environment before each test
123-
setupFiles: [
124-
'./tests/setup.js'
125-
],
126-
127-
// A list of paths to modules that run some code to configure or set up the testing framework before each test
128-
// setupFilesAfterEnv: [],
129-
130-
// The number of seconds after which a test is considered as slow and reported as such in the results.
131-
// slowTestThreshold: 5,
132-
133-
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
134-
// snapshotSerializers: [],
135-
136-
// The test environment that will be used for testing
137-
// testEnvironment: "jest-environment-jsdom",
138-
139-
// Options that will be passed to the testEnvironment
140-
// testEnvironmentOptions: {},
141-
142-
// Adds a location field to test results
143-
// testLocationInResults: false,
144-
145-
// The glob patterns Jest uses to detect test files
146-
// testMatch: [
147-
// "**/__tests__/**/*.[jt]s?(x)",
148-
// "**/?(*.)+(spec|test).[tj]s?(x)"
149-
// ],
150-
151-
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
152-
testPathIgnorePatterns: [
153-
"/node_modules/"
154-
],
155-
156-
// The regexp pattern or array of patterns that Jest uses to detect test files
157-
// testRegex: [],
158-
159-
// This option allows the use of a custom results processor
160-
// testResultsProcessor: undefined,
161-
162-
// This option allows use of a custom test runner
163-
// testRunner: "jasmine2",
164-
165-
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
166-
// testURL: "http://localhost",
167-
168-
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
169-
// timers: "real",
170-
171-
// A map from regular expressions to paths to transformers
172-
// transform: undefined,
173-
174-
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
175-
// transformIgnorePatterns: [
176-
// "/node_modules/",
177-
// "\\.pnp\\.[^\\/]+$"
178-
// ],
179-
180-
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
181-
// unmockedModulePathPatterns: undefined,
182-
183-
// Indicates whether each individual test should be reported during the run
184-
// verbose: undefined,
185-
186-
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
187-
// watchPathIgnorePatterns: [],
188-
189-
// Whether to use watchman for file crawling
190-
// watchman: true,
19123
};

0 commit comments

Comments
 (0)