1
0
mirror of synced 2026-01-01 09:04:46 -05:00
Files
docs/tests/meta/orphan-tests.js
Vanessa Yuen 3df90fc9b8 Hello git history spelunker!
Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
2020-09-27 14:10:11 +02:00

22 lines
725 B
JavaScript

const fs = require('fs')
const path = require('path')
describe('check for orphan tests', () => {
test('all tests are in sub-directories', () => {
// A known list of exceptions that can live outside of directories
const EXCEPTIONS = ['README.md', 'helpers.js']
const pathToTests = path.join(process.cwd(), 'tests')
// Get a list of files/directories in `/tests`
const testDirectory = fs.readdirSync(pathToTests)
const filteredList = testDirectory
// Filter out our exceptions
.filter(item => !EXCEPTIONS.includes(item))
// Don't include directories
.filter(item => !fs.statSync(path.join(pathToTests, item)).isDirectory())
expect(filteredList).toHaveLength(0)
})
})