Skip to content

Commit ecbbee3

Browse files
authored
test: remove barrier files to improve unit testing performance (#249)
* test: remove barrier files to improve unit testing performance * chore: change check-types command
1 parent 1038a3a commit ecbbee3

171 files changed

Lines changed: 501 additions & 517 deletions

File tree

Some content is hidden

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

jest.config.js

Lines changed: 126 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -4,187 +4,181 @@
44
*/
55

66
module.exports = {
7-
// All imported modules in your tests should be mocked automatically
8-
// automock: false,
7+
// All imported modules in your tests should be mocked automatically
8+
// automock: false,
99

10-
// Stop running tests after `n` failures
11-
// bail: 0,
10+
// Stop running tests after `n` failures
11+
// bail: 0,
1212

13-
// The directory where Jest should store its cached dependency information
14-
// cacheDirectory: "/private/var/folders/70/21p94l8j6cd9vv9t990g8cj00000gn/T/jest_dx",
13+
// The directory where Jest should store its cached dependency information
14+
// cacheDirectory: "/private/var/folders/70/21p94l8j6cd9vv9t990g8cj00000gn/T/jest_dx",
1515

16-
// Automatically clear mock calls, instances, contexts and results before every test
17-
clearMocks: true,
16+
// Automatically clear mock calls, instances, contexts and results before every test
17+
clearMocks: true,
1818

19-
// Indicates whether the coverage information should be collected while executing the test
20-
collectCoverage: true,
19+
// Indicates whether the coverage information should be collected while executing the test
20+
collectCoverage: true,
2121

22-
// An array of glob patterns indicating a set of files for which coverage information should be collected
23-
// collectCoverageFrom: undefined,
22+
// An array of glob patterns indicating a set of files for which coverage information should be collected
23+
// collectCoverageFrom: undefined,
2424

25-
// The directory where Jest should output its coverage files
26-
coverageDirectory: "coverage",
25+
// The directory where Jest should output its coverage files
26+
coverageDirectory: 'coverage',
2727

28-
// An array of regexp pattern strings used to skip coverage collection
29-
// coveragePathIgnorePatterns: [
30-
// "/node_modules/"
31-
// ],
28+
// An array of regexp pattern strings used to skip coverage collection
29+
// coveragePathIgnorePatterns: [
30+
// "/node_modules/"
31+
// ],
3232

33-
// Indicates which provider should be used to instrument code for coverage
34-
// coverageProvider: "babel",
33+
// Indicates which provider should be used to instrument code for coverage
34+
// coverageProvider: "babel",
3535

36-
// A list of reporter names that Jest uses when writing coverage reports
37-
// coverageReporters: [
38-
// "json",
39-
// "text",
40-
// "lcov",
41-
// "clover"
42-
// ],
36+
// A list of reporter names that Jest uses when writing coverage reports
37+
// coverageReporters: [
38+
// "json",
39+
// "text",
40+
// "lcov",
41+
// "clover"
42+
// ],
4343

44-
// An object that configures minimum threshold enforcement for coverage results
45-
// coverageThreshold: undefined,
44+
// An object that configures minimum threshold enforcement for coverage results
45+
// coverageThreshold: undefined,
4646

47-
// A path to a custom dependency extractor
48-
// dependencyExtractor: undefined,
47+
// A path to a custom dependency extractor
48+
// dependencyExtractor: undefined,
4949

50-
// Make calling deprecated APIs throw helpful error messages
51-
// errorOnDeprecated: false,
50+
// Make calling deprecated APIs throw helpful error messages
51+
// errorOnDeprecated: false,
5252

53-
// The default configuration for fake timers
54-
// fakeTimers: {
55-
// "enableGlobally": false
56-
// },
53+
// The default configuration for fake timers
54+
// fakeTimers: {
55+
// "enableGlobally": false
56+
// },
5757

58-
// Force coverage collection from ignored files using an array of glob patterns
59-
// forceCoverageMatch: [],
58+
// Force coverage collection from ignored files using an array of glob patterns
59+
// forceCoverageMatch: [],
6060

61-
// A path to a module which exports an async function that is triggered once before all test suites
62-
// globalSetup: undefined,
61+
// A path to a module which exports an async function that is triggered once before all test suites
62+
// globalSetup: undefined,
6363

64-
// A path to a module which exports an async function that is triggered once after all test suites
65-
// globalTeardown: undefined,
64+
// A path to a module which exports an async function that is triggered once after all test suites
65+
// globalTeardown: undefined,
6666

67-
// A set of global variables that need to be available in all test environments
68-
// globals: {},
67+
// A set of global variables that need to be available in all test environments
68+
// globals: {},
6969

70-
// 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.
71-
// maxWorkers: "50%",
70+
// 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.
71+
// maxWorkers: "50%",
7272

73-
// An array of directory names to be searched recursively up from the requiring module's location
74-
// moduleDirectories: [
75-
// "node_modules"
76-
// ],
73+
// An array of directory names to be searched recursively up from the requiring module's location
74+
// moduleDirectories: [
75+
// "node_modules"
76+
// ],
7777

78-
// An array of file extensions your modules use
79-
moduleFileExtensions: [
80-
"js",
81-
"mjs",
82-
"cjs",
83-
"jsx",
84-
"ts",
85-
"tsx",
86-
"json",
87-
"node",
88-
],
78+
// An array of file extensions your modules use
79+
moduleFileExtensions: ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node'],
8980

90-
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
91-
// moduleNameMapper: {},
81+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
82+
moduleNameMapper: {
83+
'^src/(.*)$': '<rootDir>/src/$1',
84+
'^test/(.*)$': '<rootDir>/test/$1',
85+
},
9286

93-
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
94-
// modulePathIgnorePatterns: [],
87+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
88+
// modulePathIgnorePatterns: [],
9589

96-
// Activates notifications for test results
97-
// notify: false,
90+
// Activates notifications for test results
91+
// notify: false,
9892

99-
// An enum that specifies notification mode. Requires { notify: true }
100-
// notifyMode: "failure-change",
93+
// An enum that specifies notification mode. Requires { notify: true }
94+
// notifyMode: "failure-change",
10195

102-
// A preset that is used as a base for Jest's configuration
103-
// preset: "ts-jest/presets/js-with-ts-esm",
96+
// A preset that is used as a base for Jest's configuration
97+
// preset: "ts-jest/presets/js-with-ts-esm",
10498

105-
// Run tests from one or more projects
106-
// projects: undefined,
99+
// Run tests from one or more projects
100+
// projects: undefined,
107101

108-
// Use this configuration option to add custom reporters to Jest
109-
// reporters: undefined,
102+
// Use this configuration option to add custom reporters to Jest
103+
// reporters: undefined,
110104

111-
// Automatically reset mock state before every test
112-
// resetMocks: false,
105+
// Automatically reset mock state before every test
106+
// resetMocks: false,
113107

114-
// Reset the module registry before running each individual test
115-
// resetModules: false,
108+
// Reset the module registry before running each individual test
109+
// resetModules: false,
116110

117-
// A path to a custom resolver
118-
// resolver: undefined,
111+
// A path to a custom resolver
112+
// resolver: undefined,
119113

120-
// Automatically restore mock state and implementation before every test
121-
// restoreMocks: false,
114+
// Automatically restore mock state and implementation before every test
115+
// restoreMocks: false,
122116

123-
// The root directory that Jest should scan for tests and modules within
124-
// rootDir: undefined,
117+
// The root directory that Jest should scan for tests and modules within
118+
// rootDir: undefined,
125119

126-
// A list of paths to directories that Jest should use to search for files in
127-
// roots: [
128-
// "<rootDir>"
129-
// ],
120+
// A list of paths to directories that Jest should use to search for files in
121+
// roots: [
122+
// "<rootDir>"
123+
// ],
130124

131-
// Allows you to use a custom runner instead of Jest's default test runner
132-
// runner: "jest-runner",
125+
// Allows you to use a custom runner instead of Jest's default test runner
126+
// runner: "jest-runner",
133127

134-
// The paths to modules that run some code to configure or set up the testing environment before each test
135-
// setupFiles: [],
128+
// The paths to modules that run some code to configure or set up the testing environment before each test
129+
// setupFiles: [],
136130

137-
// A list of paths to modules that run some code to configure or set up the testing framework before each test
138-
// setupFilesAfterEnv: [],
131+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
132+
// setupFilesAfterEnv: [],
139133

140-
// The number of seconds after which a test is considered as slow and reported as such in the results.
141-
// slowTestThreshold: 5,
134+
// The number of seconds after which a test is considered as slow and reported as such in the results.
135+
// slowTestThreshold: 5,
142136

143-
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
144-
// snapshotSerializers: [],
137+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
138+
// snapshotSerializers: [],
145139

146-
// The test environment that will be used for testing
147-
testEnvironment: "node",
140+
// The test environment that will be used for testing
141+
testEnvironment: 'node',
148142

149-
// Options that will be passed to the testEnvironment
150-
// testEnvironmentOptions: {},
143+
// Options that will be passed to the testEnvironment
144+
// testEnvironmentOptions: {},
151145

152-
// Adds a location field to test results
153-
// testLocationInResults: false,
146+
// Adds a location field to test results
147+
// testLocationInResults: false,
154148

155-
// The glob patterns Jest uses to detect test files
156-
testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[tj]s?(x)"],
149+
// The glob patterns Jest uses to detect test files
150+
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
157151

158-
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
159-
// testPathIgnorePatterns: [
160-
// "/node_modules/"
161-
// ],
152+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
153+
// testPathIgnorePatterns: [
154+
// "/node_modules/"
155+
// ],
162156

163-
// The regexp pattern or array of patterns that Jest uses to detect test files
164-
// testRegex: [],
157+
// The regexp pattern or array of patterns that Jest uses to detect test files
158+
// testRegex: [],
165159

166-
// This option allows the use of a custom results processor
167-
// testResultsProcessor: undefined,
160+
// This option allows the use of a custom results processor
161+
// testResultsProcessor: undefined,
168162

169-
// This option allows use of a custom test runner
170-
// testRunner: "jest-circus/runner",
163+
// This option allows use of a custom test runner
164+
// testRunner: "jest-circus/runner",
171165

172-
// A map from regular expressions to paths to transformers
173-
transform: {
174-
"\\.[jt]sx?$": ['@swc/jest']
175-
},
166+
// A map from regular expressions to paths to transformers
167+
transform: {
168+
'\\.[jt]sx?$': ['@swc/jest'],
169+
},
176170

177-
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
178-
extensionsToTreatAsEsm: ['.ts', '.tsx'],
179-
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
180-
// unmockedModulePathPatterns: undefined,
171+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
172+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
173+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
174+
// unmockedModulePathPatterns: undefined,
181175

182-
// Indicates whether each individual test should be reported during the run
183-
// verbose: undefined,
176+
// Indicates whether each individual test should be reported during the run
177+
// verbose: undefined,
184178

185-
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
186-
// watchPathIgnorePatterns: [],
179+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
180+
// watchPathIgnorePatterns: [],
187181

188-
// Whether to use watchman for file crawling
189-
// watchman: true
182+
// Whether to use watchman for file crawling
183+
// watchman: true
190184
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"prepublishOnly": "npm run build",
2424
"antlr4": "node ./scripts/antlr4.js",
2525
"build": "rm -rf dist && tsc",
26-
"check-types": "tsc -p ./tsconfig.check.json",
26+
"check-types": "tsc -p ./tsconfig.json && tsc -p ./test/tsconfig.json",
2727
"test": "NODE_OPTIONS=--max_old_space_size=4096 && jest",
2828
"release": "node ./scripts/release.js",
2929
"lint": "prettier --check '**/*.ts' --config ./.prettierrc",

test/common/basicParser.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { CommonTokenStream, ErrorListener, FlinkSQL, FlinkSqlLexer } from '../filters';
1+
import FlinkSQL from 'src/parser/flinksql';
2+
import { FlinkSqlLexer } from 'src/lib/flinksql/FlinkSqlLexer';
3+
import { ErrorListener } from 'src/parser/common/parseErrorListener';
4+
import { CommonTokenStream } from 'antlr4ts';
25

36
describe('BasicParser unit tests', () => {
47
const flinkParser = new FlinkSQL();

test/filters/index.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)