Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: detect tests in folders starting with . (fix #2344) (#2359)
* fix(core): Enable `dot` in globOptions

* test(core): Add test for files in `.` folders.

* test(core): Fix test for files in `.` folders.
  • Loading branch information
sidharthv96 committed Nov 21, 2022
1 parent f7b27af commit c395177
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/vitest/src/node/core.ts
Expand Up @@ -553,8 +553,9 @@ export class Vitest {
async globTestFiles(filters: string[] = []) {
const { include, exclude, includeSource } = this.config

const globOptions = {
const globOptions: fg.Options = {
absolute: true,
dot: true,
cwd: this.config.dir || this.config.root,
ignore: exclude,
}
Expand Down
5 changes: 5 additions & 0 deletions test/fails/fixtures/.dot-folder/dot-test.test.ts
@@ -0,0 +1,5 @@
import { expect, test } from 'vitest'

test('check that tests inside folder with . is run', () => {
expect(true).toBe(false)
})
2 changes: 2 additions & 0 deletions test/fails/test/__snapshots__/runner.test.ts.snap
@@ -1,5 +1,7 @@
// Vitest Snapshot v1

exports[`should fails > .dot-folder/dot-test.test.ts > .dot-folder/dot-test.test.ts 1`] = `"AssertionError: expected true to be false // Object.is equality"`;

exports[`should fails > each-timeout.test.ts > each-timeout.test.ts 1`] = `"Error: Test timed out in 10ms."`;

exports[`should fails > empty.test.ts > empty.test.ts 1`] = `"Error: No test suite found in file <rootDir>/empty.test.ts"`;
Expand Down
2 changes: 1 addition & 1 deletion test/fails/test/runner.test.ts
Expand Up @@ -5,7 +5,7 @@ import { describe, expect, it } from 'vitest'

describe('should fails', async () => {
const root = resolve(__dirname, '../fixtures')
const files = await fg('*.test.ts', { cwd: root })
const files = await fg('**/*.test.ts', { cwd: root, dot: true })

for (const file of files) {
it(file, async () => {
Expand Down

0 comments on commit c395177

Please sign in to comment.