Skip to content

Commit ce0cfea

Browse files
Fix: Test script cannot detect test under test directory with deep level (#708)
* Fix glob pattern in test script * Update generate.js Co-authored-by: Matteo Collina <matteo.collina@gmail.com> Signed-off-by: adamward459 <adamward459@gmail.com> * Fix test script in generate-typescript.test.js * Fix test script in generate.js * Fix missing line break in generate-typescript.test.js * Fix missing line break in generate-typescript.test.js --------- Signed-off-by: adamward459 <adamward459@gmail.com> Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
1 parent 2632223 commit ce0cfea

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const typescriptTemplate = {
4747
dir: 'app-ts',
4848
main: 'app.ts',
4949
scripts: {
50-
test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register test/**/*.ts',
50+
test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register "test/**/*.ts"',
5151
start: 'npm run build:ts && fastify start -l info dist/app.js',
5252
'build:ts': 'tsc',
5353
'watch:ts': 'tsc -w',

test/generate-typescript.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function define (t) {
126126
// by default this will be ISC but since we have a MIT licensed pkg file in upper dir, npm will set the license to MIT in this case
127127
// so for local tests we need to accept MIT as well
128128
t.ok(pkg.license === 'ISC' || pkg.license === 'MIT')
129-
t.equal(pkg.scripts.test, 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register test/**/*.ts')
129+
t.equal(pkg.scripts.test, 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register "test/**/*.ts"')
130130
t.equal(pkg.scripts.start, 'npm run build:ts && fastify start -l info dist/app.js')
131131
t.equal(pkg.scripts['build:ts'], 'tsc')
132132
t.equal(pkg.scripts['watch:ts'], 'tsc -w')
@@ -143,7 +143,7 @@ function define (t) {
143143
t.equal(pkg.devDependencies.concurrently, cliPkg.devDependencies.concurrently)
144144
t.equal(pkg.devDependencies.typescript, cliPkg.devDependencies.typescript)
145145

146-
const testGlob = pkg.scripts.test.split(' ', 14)[13]
146+
const testGlob = pkg.scripts.test.split(' ', 14)[13].replaceAll('"', '')
147147

148148
t.equal(minimatch.match(['test/routes/plugins/more/test/here/ok.test.ts'], testGlob).length, 1, 'should match glob')
149149
resolve()

0 commit comments

Comments
 (0)