Skip to content

Commit

Permalink
Update glob to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhdev committed Jan 30, 2025
1 parent f2c18d2 commit df7a929
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 107 deletions.
86 changes: 21 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"eslint-config-prettier": "^10.0.1",
"eslint-config-xo": "^0.45.0",
"eslint-plugin-prettier": "^5.2.3",
"glob": "^8.0.0",
"glob": "^11.0.1",
"husky": "^4.0.0",
"lint-staged": "^15.4.3",
"mocha": "^11.1.0",
Expand Down
36 changes: 16 additions & 20 deletions src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as glob from 'glob'
import { globSync } from 'glob'
import * as Mocha from 'mocha'
import * as path from 'path'

Expand All @@ -11,26 +11,22 @@ export function run(): Promise<void> {
})

return new Promise((c, e) => {
glob('./**/*.test.js', { cwd: __dirname }, (err, files) => {
if (err) {
return e(err)
}
const files = globSync('./**/*.test.js', { cwd: __dirname })

// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(__dirname, f)))
// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(__dirname, f)))

try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`))
} else {
c()
}
})
} catch (err) {
e(err)
}
})
try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`))
} else {
c()
}
})
} catch (err) {
e(err)
}
})
}
37 changes: 16 additions & 21 deletions src/test/untitled-suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as glob from 'glob'
import { globSync } from 'glob'
import * as Mocha from 'mocha'
import * as path from 'path'

Expand All @@ -11,26 +11,21 @@ export function run(): Promise<void> {
})

return new Promise((c, e) => {
glob('./**/*.test.js', { cwd: __dirname }, (err, files) => {
if (err) {
return e(err)
}
const files = globSync('./**/*.test.js', { cwd: __dirname })
// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(__dirname, f)))

// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(__dirname, f)))

try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`))
} else {
c()
}
})
} catch (err) {
e(err)
}
})
try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`))
} else {
c()
}
})
} catch (err) {
e(err)
}
})
}

0 comments on commit df7a929

Please sign in to comment.