1
- // extension:
2
- // - ts
3
- // require:
4
- // - 'tsconfig-paths/register'
5
- // - './test/ts-node.js'
6
- // - 'ts-custom-error-shim'
7
- // - './test/mocha.config'
8
- // - 'test/sandbox.ts'
9
- // ignore:
10
- // - node_modules
11
- // spec:
12
- // - 'packages/*/*/{,(!node_modules)/}index.ts'
13
- // - 'packages/*/*/{,(!node_modules)/*/}*/index.ts'
14
- // - 'packages/*/*/{,(!node_modules)/}src/**/*.spec.ts'
15
- // - 'packages/*/*/{,(!node_modules)/*/}*/src/**/*.spec.ts'
16
- // - 'packages/*/*/{,(!node_modules)/}src/**/*.int-spec.ts'
17
- // - 'packages/*/*/{,(!node_modules)/*/}*/src/**/*.int-spec.ts'
18
-
19
1
const { readdirSync, statSync } = require ( 'fs' )
20
2
const { dirname, resolve } = require ( 'path' )
21
3
22
- const [ , , scopesArg , ...scopes ] = process . argv
4
+ const [ , , scopesArg , ...scopes ] = process . argv
23
5
if ( scopesArg !== '--scope' ) {
24
6
scopes . length = 0
25
7
}
26
8
27
- const manifest = require ( './.tsconfig.builder.json' ) . include . filter ( file => file . endsWith ( 'index.ts' ) )
9
+ const manifest = require ( './.tsconfig.builder.json' ) . include . filter ( ( file ) => file . endsWith ( 'index.ts' ) )
28
10
function findPaths ( dir ) {
29
11
const subDirs = readdirSync ( dir )
30
12
return subDirs
31
- . filter ( subDir => subDir !== 'src' && subDir !== 'node_modules' && subDir !== '.yarn-cache' )
32
- . map ( subDir => `${ dir } /${ subDir } ` )
33
- . filter ( subDir => statSync ( subDir ) . isDirectory ( ) )
13
+ . filter ( ( subDir ) => subDir !== 'src' && subDir !== 'node_modules' && subDir !== '.yarn-cache' )
14
+ . map ( ( subDir ) => `${ dir } /${ subDir } ` )
15
+ . filter ( ( subDir ) => statSync ( subDir ) . isDirectory ( ) )
34
16
. reduce ( ( result , subDir ) => {
35
17
result . push ( subDir )
36
18
result . push ( ...findPaths ( subDir ) )
37
19
return result
38
20
} , [ ] )
39
21
}
40
22
const paths = manifest
41
- . filter ( path => {
23
+ . filter ( ( path ) => {
42
24
if ( ! scopes . length ) {
43
25
return true
44
26
}
45
- return scopes . some ( scope => path . startsWith ( `packages/${ scope } /` ) )
27
+ return scopes . some ( ( scope ) => path . startsWith ( `packages/${ scope } /` ) )
46
28
} )
47
29
. reduce ( ( result , file ) => {
48
30
const dir = dirname ( file )
49
31
result . push ( dir , ...findPaths ( resolve ( __dirname , dir ) ) )
50
32
return result
51
33
} , [ ] )
52
- const barrels = paths . map ( path => `${ path } /index.ts` )
53
- const unitSpec = paths . map ( path => `${ path } /src/**/*.spec.ts` )
54
- const intSpec = paths . map ( path => `${ path } /src/**/*.int-spec.ts` )
55
- const spec = [
56
- ...barrels ,
57
- ...unitSpec ,
58
- ...intSpec ,
59
- ]
34
+ const barrels = paths . map ( ( path ) => `${ path } /index.ts` )
35
+ const unitSpec = paths . map ( ( path ) => `${ path } /src/**/*.spec.ts` )
36
+ const intSpec = paths . map ( ( path ) => `${ path } /src/**/*.int-spec.ts` )
37
+ const spec = [ ...barrels , ...unitSpec , ...intSpec ]
60
38
61
39
// suppress "Cannot find any files matching pattern" warnings from mocha startup
62
40
console . __ogWarn = console . warn
@@ -69,25 +47,14 @@ console.warn = (msg, ...args) => {
69
47
70
48
module . exports = {
71
49
extension : 'ts' ,
72
- ignore : [
73
- '.out' ,
74
- '.build' ,
75
- 'dist' ,
76
- ] ,
77
- watchIgnore : [
78
- '.out' ,
79
- '.build' ,
80
- 'dist' ,
81
- ] ,
50
+ ignore : [ '.out' , '.build' , 'dist' ] ,
51
+ watchIgnore : [ '.out' , '.build' , 'dist' ] ,
82
52
require : [
83
53
'tsconfig-paths/register' ,
84
54
resolve ( __dirname , './test/ts-node.js' ) ,
85
55
'ts-custom-error-shim' ,
86
56
resolve ( __dirname , './test/mocha.config' ) ,
87
57
] ,
88
- file : [
89
- resolve ( __dirname , 'test/sandbox.ts' ) ,
90
- ...manifest ,
91
- ] ,
58
+ file : [ resolve ( __dirname , 'test/sandbox.ts' ) , ...manifest ] ,
92
59
spec,
93
60
}
0 commit comments