File tree Expand file tree Collapse file tree 17 files changed +44
-33
lines changed Expand file tree Collapse file tree 17 files changed +44
-33
lines changed Original file line number Diff line number Diff line change @@ -237,10 +237,10 @@ module.exports = {
237
237
} ,
238
238
{
239
239
files : [
240
+ 'e2e/**' ,
240
241
'website/**' ,
242
+ '**/__benchmarks__/**' ,
241
243
'**/__tests__/**' ,
242
- 'e2e/**' ,
243
- '**/pretty-format/perf/**' ,
244
244
'packages/jest-types/**/*' ,
245
245
'.eslintplugin/**' ,
246
246
] ,
@@ -263,6 +263,7 @@ module.exports = {
263
263
{
264
264
files : [
265
265
'scripts/*' ,
266
+ 'packages/*/__benchmarks__/test.js' ,
266
267
'packages/jest-cli/src/init/index.ts' ,
267
268
'packages/jest-repl/src/cli/runtime-cli.ts' ,
268
269
] ,
@@ -274,14 +275,10 @@ module.exports = {
274
275
files : [
275
276
'e2e/**' ,
276
277
'examples/**' ,
277
- 'scripts/*' ,
278
278
'website/**' ,
279
279
'**/__mocks__/**' ,
280
280
'**/__tests__/**' ,
281
281
'**/__typetests__/**' ,
282
- '**/__performance_tests__/**' ,
283
- 'packages/diff-sequences/perf/index.js' ,
284
- 'packages/pretty-format/perf/test.js' ,
285
282
] ,
286
283
rules : {
287
284
'@typescript-eslint/no-unused-vars' : 'off' ,
Original file line number Diff line number Diff line change 9
9
/packages /* /build
10
10
/packages /* /dist
11
11
/packages /jest-config /src /__tests__ /jest-preset.json
12
- /packages /pretty-format /perf /world.geo.json
12
+ /packages /pretty-format /__benchmarks__ /world.geo.json
13
13
14
14
# Breaks tests
15
15
/e2e /coverage-handlebars /greet.hbs
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default {
15
15
'**/packages/*/**/*.ts' ,
16
16
'!**/bin/**' ,
17
17
'!**/cli/**' ,
18
- '!**/perf /**' ,
18
+ '!**/__benchmarks__ /**' ,
19
19
'!**/__mocks__/**' ,
20
20
'!**/__tests__/**' ,
21
21
'!**/__typetests__/**' ,
@@ -38,6 +38,7 @@ export default {
38
38
snapshotSerializers : [ require . resolve ( 'pretty-format/ConvertAnsi' ) ] ,
39
39
testPathIgnorePatterns : [
40
40
'/__arbitraries__/' ,
41
+ '/__benchmarks__/' ,
41
42
'/__typetests__/' ,
42
43
'/node_modules/' ,
43
44
'/examples/' ,
@@ -64,8 +65,6 @@ export default {
64
65
'/packages/jest-snapshot/src/__tests__/plugins' ,
65
66
'/packages/jest-snapshot/src/__tests__/fixtures/' ,
66
67
'/packages/jest-validate/src/__tests__/fixtures/' ,
67
- '/packages/jest-worker/src/__performance_tests__' ,
68
- '/packages/pretty-format/perf/test.js' ,
69
68
'/e2e/__tests__/iterator-to-null-test.ts' ,
70
69
] ,
71
70
testTimeout : 70000 ,
Original file line number Diff line number Diff line change 106
106
"test-types" : " yarn jest --config jest.config.tsd.mjs" ,
107
107
"test-ci-partial" : " yarn test-ci-partial:parallel -i" ,
108
108
"test-ci-partial:parallel" : " yarn jest --color --config jest.config.ci.mjs" ,
109
- "test-pretty-format-perf" : " node packages/pretty-format/perf/test.js" ,
110
109
"test-leak" : " yarn jest -i --detectLeaks --color jest-mock jest-diff jest-repl pretty-format" ,
111
110
"test" : " yarn lint && yarn jest" ,
112
111
"verify-old-ts" : " node ./scripts/verifyOldTs.mjs" ,
Original file line number Diff line number Diff line change 1
1
** /__mocks__ /**
2
2
** /__tests__ /**
3
+ __benchmarks__
3
4
__typetests__
4
5
src
5
6
tsconfig.json
File renamed without changes.
Original file line number Diff line number Diff line change 5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- // Make sure to run node with --expose-gc option!
9
-
10
- // The times are reliable if about 1% relative mean error if you run it:
8
+ /**
9
+ * To start the test, build the repo and run:
10
+ * node --expose-gc test.js
11
+ */
11
12
12
- // * immediately after restart
13
- // * with 100% battery charge
14
- // * not connected to network
13
+ /**
14
+ * The times are reliable if about 1% relative mean error if you run it:
15
+ * - immediately after restart
16
+ * - with 100% battery charge
17
+ * - not connected to network
18
+ */
15
19
16
- /* eslint import/no-extraneous-dependencies: "off" */
20
+ 'use strict' ;
17
21
18
22
const Benchmark = require ( 'benchmark' ) ;
19
23
const diffBaseline = require ( 'diff' ) . diffLines ;
20
- const diffImproved = require ( '../build/index.js ' ) . default ;
24
+ const diffImproved = require ( '../' ) . default ;
21
25
22
26
const testBaseline = ( a , b ) => {
23
27
const benchmark = new Benchmark ( {
@@ -163,6 +167,10 @@ const testLength = n => {
163
167
) ; // simulate TDD
164
168
} ;
165
169
170
+ if ( ! globalThis . gc ) {
171
+ throw new Error ( 'GC not present, start with: node --expose-gc test.js' ) ;
172
+ }
173
+
166
174
writeHeading2 ( ) ;
167
175
168
176
testLength ( 20 ) ;
Original file line number Diff line number Diff line change 27
27
},
28
28
"./package.json" : " ./package.json"
29
29
},
30
- "scripts" : {
31
- "perf" : " node --expose-gc perf/index.js"
32
- },
33
30
"devDependencies" : {
34
31
"benchmark" : " ^2.1.4" ,
35
32
"diff" : " ^5.0.0" ,
Original file line number Diff line number Diff line change 1
1
** /__mocks__ /**
2
2
** /__tests__ /**
3
- ** / __performance_tests__ / **
3
+ __benchmarks__
4
4
__typetests__
5
5
src
6
6
tsconfig.json
Original file line number Diff line number Diff line change 5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
+ /**
9
+ * To start the test, build the repo and run:
10
+ * node --expose-gc test.js empty 100000
11
+ * node --expose-gc test.js loadTest 10000
12
+ */
13
+
8
14
'use strict' ;
9
15
10
16
const assert = require ( 'assert' ) ;
11
17
const { performance} = require ( 'perf_hooks' ) ;
12
- // eslint-disable-next-line import/no-extraneous-dependencies
13
18
const workerFarm = require ( 'worker-farm' ) ;
14
- const JestWorker = require ( '../../build ' ) . Worker ;
19
+ const JestWorker = require ( '../' ) . Worker ;
15
20
16
- // Typical tests: node --expose-gc test.js empty 100000
17
- // node --expose-gc test.js loadTest 10000
18
21
assert ( process . argv [ 2 ] , 'Pass a child method name' ) ;
19
22
assert ( process . argv [ 3 ] , 'Pass the number of iterations' ) ;
20
23
21
24
const sleep = ms => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
22
25
const method = process . argv [ 2 ] ;
23
- const calls = + process . argv [ 3 ] ;
26
+ const calls = Number ( process . argv [ 3 ] ) ;
24
27
const threads = 6 ;
25
28
const iterations = 10 ;
26
29
@@ -127,7 +130,7 @@ function profileEnd(x) {
127
130
128
131
async function main ( ) {
129
132
if ( ! globalThis . gc ) {
130
- console . warn ( 'GC not present, start with node --expose-gc' ) ;
133
+ throw new Error ( 'GC not present, start with node --expose-gc' ) ;
131
134
}
132
135
133
136
const wFResults = [ ] ;
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 5
5
"outDir" : " build"
6
6
},
7
7
"include" : [" ./src/**/*" ],
8
- "exclude" : [" ./**/__performance_tests__/**/* " , " ./**/ __tests__/**/*" ],
8
+ "exclude" : [" ./**/__tests__/**/*" ],
9
9
"references" : [{"path" : " ../jest-leak-detector" }]
10
10
}
Original file line number Diff line number Diff line change 1
1
** /__mocks__ /**
2
2
** /__tests__ /**
3
+ __benchmarks__
3
4
__typetests__
4
5
src
5
- perf
6
6
tsconfig.json
7
7
tsconfig.tsbuildinfo
8
8
api-extractor.json
Original file line number Diff line number Diff line change 5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
+ /**
9
+ * To start the test, build the repo and run:
10
+ * node test.js
11
+ */
12
+
13
+ 'use strict' ;
14
+
8
15
const util = require ( 'util' ) ;
9
16
const chalk = require ( 'chalk' ) ;
10
17
const React = require ( 'react' ) ;
11
18
const ReactTestRenderer = require ( 'react-test-renderer' ) ;
12
19
const { formatTime} = require ( 'jest-util' ) ;
13
- const prettyFormat = require ( '../build' ) ;
14
- const ReactTestComponent = require ( '../build/plugins/ReactTestComponent' ) ;
20
+ const prettyFormat = require ( '../' ) . format ;
21
+ const { ReactTestComponent} = require ( '../' ) . plugins ;
15
22
const worldGeoJson = require ( './world.geo.json' ) ;
16
23
17
24
const NANOSECONDS = 1000000000 ;
File renamed without changes.
You can’t perform that action at this time.
0 commit comments