Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Detect tests in folders starting with . (fix #2344) #2359

Merged
merged 3 commits into from Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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