Skip to content

Commit

Permalink
test: optimize split params (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Oct 23, 2023
1 parent e435cac commit 6b3a0b4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/generate-esm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function define (t) {
// Test for "type:module"
t.equal(pkg.type, 'module')

const testGlob = pkg.scripts.test.split(' ')[2].replace(/"/g, '')
const testGlob = pkg.scripts.test.split(' ', 3)[2].replace(/"/g, '')
t.equal(minimatch.match(['test/services/plugins/more/test/here/ok.test.js'], testGlob).length, 1)
resolve()
})
Expand Down
2 changes: 1 addition & 1 deletion test/generate-plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function define (t) {
t.equal(pkg.devDependencies.typescript, cliPkg.devDependencies.typescript)
t.same(pkg.tsd, pluginTemplate.tsd)

const testGlob = pkg.scripts.unit.split(' ')[1].replace(/"/g, '')
const testGlob = pkg.scripts.unit.split(' ', 2)[1].replace(/"/g, '')
t.equal(minimatch.match(['test/more/test/here/ok.test.js'], testGlob).length, 1)
resolve()
})
Expand Down
2 changes: 1 addition & 1 deletion test/generate-typescript-esm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function define (t) {
t.equal(pkg.devDependencies.tap, cliPkg.devDependencies.tap)
t.equal(pkg.devDependencies.typescript, cliPkg.devDependencies.typescript)

const testGlob = pkg.scripts.test.split(' ')[10].replace(/"/g, '')
const testGlob = pkg.scripts.test.split(' ', 11)[10].replace(/"/g, '')

t.equal(minimatch.match(['test/routes/plugins/more/test/here/ok.test.ts'], testGlob).length, 1)
resolve()
Expand Down
2 changes: 1 addition & 1 deletion test/generate-typescript.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function define (t) {
t.equal(pkg.devDependencies.tap, cliPkg.devDependencies.tap)
t.equal(pkg.devDependencies.typescript, cliPkg.devDependencies.typescript)

const testGlob = pkg.scripts.test.split(' ')[10].replace(/"/g, '')
const testGlob = pkg.scripts.test.split(' ', 11)[10].replace(/"/g, '')

t.equal(minimatch.match(['test/routes/plugins/more/test/here/ok.test.ts'], testGlob).length, 1)
resolve()
Expand Down
2 changes: 1 addition & 1 deletion test/generate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function define (t) {
t.equal(pkg.dependencies['@fastify/sensible'], cliPkg.devDependencies['@fastify/sensible'])
t.equal(pkg.devDependencies.tap, cliPkg.devDependencies.tap)

const testGlob = pkg.scripts.test.split(' ')[1].replace(/"/g, '')
const testGlob = pkg.scripts.test.split(' ', 2)[1].replace(/"/g, '')
t.equal(minimatch.match(['test/services/plugins/more/test/here/ok.test.js'], testGlob).length, 1)
resolve()
})
Expand Down

0 comments on commit 6b3a0b4

Please sign in to comment.