mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
chore: enable eslint-plugin-jest (#6375)
This commit is contained in:
parent
3e5944ef1f
commit
52db7320a6
32 changed files with 194 additions and 193 deletions
|
@ -38,15 +38,15 @@ describe('packages', () => {
|
|||
test('should contain repository and directory for every package', async () => {
|
||||
const packageJsonFiles = await getPackagesJsonFiles();
|
||||
|
||||
packageJsonFiles.forEach((packageJsonFile) => {
|
||||
if (packageJsonFile.content.private !== true) {
|
||||
packageJsonFiles
|
||||
.filter((packageJsonFile) => !packageJsonFile.content.private)
|
||||
.forEach((packageJsonFile) => {
|
||||
expect(packageJsonFile.content.repository).toEqual({
|
||||
type: 'git',
|
||||
url: 'https://github.com/facebook/docusaurus.git',
|
||||
directory: packageJsonFile.file.replace(/\/package\.json$/, ''),
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
|
@ -58,17 +58,19 @@ describe('packages', () => {
|
|||
test('should have publishConfig.access: "public" when name starts with @', async () => {
|
||||
const packageJsonFiles = await getPackagesJsonFiles();
|
||||
|
||||
packageJsonFiles.forEach((packageJsonFile) => {
|
||||
if (packageJsonFile.content.name.startsWith('@')) {
|
||||
// Unfortunately jest custom message do not exist in loops, so using an exception instead to show failing package file
|
||||
// (see https://github.com/facebook/jest/issues/3293)
|
||||
// expect(packageJsonFile.content.publishConfig?.access).toEqual('public');
|
||||
if (packageJsonFile.content.publishConfig?.access !== 'public') {
|
||||
throw new Error(
|
||||
`Package ${packageJsonFile.file} does not have publishConfig.access: 'public'`,
|
||||
);
|
||||
packageJsonFiles
|
||||
.filter((packageJsonFile) => packageJsonFile.content.name.startsWith('@'))
|
||||
.forEach((packageJsonFile) => {
|
||||
if (packageJsonFile) {
|
||||
// Unfortunately jest custom message do not exist in loops, so using an exception instead to show failing package file
|
||||
// (see https://github.com/facebook/jest/issues/3293)
|
||||
// expect(packageJsonFile.content.publishConfig?.access).toEqual('public');
|
||||
if (packageJsonFile.content.publishConfig?.access !== 'public') {
|
||||
throw new Error(
|
||||
`Package ${packageJsonFile.file} does not have publishConfig.access: 'public'`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue