chore: enable eslint-plugin-jest (#6375)

This commit is contained in:
Joshua Chen 2022-01-16 15:53:23 +08:00 committed by GitHub
parent 3e5944ef1f
commit 52db7320a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 194 additions and 193 deletions

View file

@ -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'`,
);
}
}
}
});
});
});
});