mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 04:04:06 +02:00
* incremental upgrade to React 18, TS 4.9, etc. * update yarn config * fix build * minor cleanup in type definitions * incremental updates for TS 5.0 * fix build * upgrade to typescript 5.2 * update dependencies * fix lint issues * update to latest Playwright version * update changesets dep * update emotion/css * incremental dependency updates * more small dependency updates * upgrade prettier and eslint * fix lint issues * update dependencies rollup * fix @types/node resolution to restore linting * update tiny-invariant dependency * update dependencies * update dependencies lerna * upgrade react-router-dom * update @types/react and @types/node * update babel dependencies * udpate simple-git-hooks * update @types/node resolution * update lint-staged * remove cypress from dependency list * update @types/node to support Node 20 * update workflows to Node 20 * set resolutions for @types/react * downgrade @types/react to 18.2.28 * update mocha * update rimraf * update @types/js-dom * remove .lintstagedrc.js * upgrade next to latest * v0.61.4 * update lerna * update faker and rollup * update immer * fix yarn clean command * attempt to fix integration tests * attempt to stabilize integration tests * wip fix integration tests * skip unstable integration test * Add changeset --------- Co-authored-by: Dalibor Tosic <dalibortosic00@gmail.com> Co-authored-by: Nikola <nikolabijelic14@gmail.com>
59 lines
1.4 KiB
JavaScript
59 lines
1.4 KiB
JavaScript
import fs from 'fs'
|
|
import { basename, extname, resolve } from 'path'
|
|
|
|
export const fixtures = (...args) => {
|
|
let fn = args.pop()
|
|
let options = { skip: false }
|
|
|
|
if (typeof fn !== 'function') {
|
|
options = fn
|
|
fn = args.pop()
|
|
}
|
|
|
|
const path = resolve(...args)
|
|
const files = fs.readdirSync(path)
|
|
const dir = basename(path)
|
|
const d = options.skip ? describe.skip : describe
|
|
|
|
d(dir, () => {
|
|
for (const file of files) {
|
|
const p = resolve(path, file)
|
|
const stat = fs.statSync(p)
|
|
|
|
if (stat.isDirectory()) {
|
|
fixtures(path, file, fn)
|
|
}
|
|
if (
|
|
stat.isFile() &&
|
|
(file.endsWith('.js') ||
|
|
file.endsWith('.tsx') ||
|
|
file.endsWith('.ts')) &&
|
|
!file.endsWith('custom-types.ts') &&
|
|
!file.endsWith('type-guards.ts') &&
|
|
!file.startsWith('.') &&
|
|
// Ignoring `index.js` files allows us to use the fixtures directly
|
|
// from the top-level directory itself, instead of only children.
|
|
file !== 'index.js'
|
|
) {
|
|
const name = basename(file, extname(file))
|
|
|
|
// This needs to be a non-arrow function to use `this.skip()`.
|
|
it(`${name} `, function () {
|
|
const module = require(p)
|
|
|
|
if (module.skip) {
|
|
this.skip()
|
|
return
|
|
}
|
|
|
|
fn({ name, path, module })
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
fixtures.skip = (...args) => {
|
|
fixtures(...args, { skip: true })
|
|
}
|