Skip to content

Commit ff10f6b

Browse files
committed
fix(test): allow scan *.test.ts
1 parent 8a97355 commit ff10f6b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/src/test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ If Scaffold detects a local Mocha installation, it uses it; otherwise, it fetche
3434

3535
### Writing Test Cases
3636

37-
Write test cases using [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/) syntax in `test/*.spec.{js,ts}`:
37+
Write test cases using [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/) syntax in `test/*.{spec,test}.{js,ts}`:
3838

3939
```js
4040
describe("Example Test", () => {

src/core/tester/test-bundler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class TestBundler {
113113
// Because esbuild only support `*` and `**`,
114114
// so we need glob ourselves.
115115
// https://esbuild.github.io/api/#glob-style-entry-points
116-
const entryPoints = (await Promise.all(testDirs.map(dir => glob(`${dir}/**/*.spec.{js,ts}`))))
116+
const entryPoints = (await Promise.all(testDirs.map(dir => glob(`${dir}/**/*.{spec,test}.[jt]s`))))
117117
.flat();
118118

119119
// Bundle all test files, including both JavaScript and TypeScript
@@ -139,7 +139,7 @@ export class TestBundler {
139139
// html
140140
let testFiles = tests;
141141
if (testFiles.length === 0) {
142-
testFiles = (await glob(`**/*.spec.js`, { cwd: `${TESTER_PLUGIN_DIR}/content` })).sort();
142+
testFiles = (await glob(`**/*.{spec,test}.js`, { cwd: `${TESTER_PLUGIN_DIR}/content` })).sort();
143143
}
144144
const html = generateHtml(setupCode, testFiles);
145145
await outputFile(`${TESTER_PLUGIN_DIR}/content/index.xhtml`, html);

0 commit comments

Comments
 (0)