Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Skip flaky global audio visual regression test (#3010)

sarayourfriend9a4c4b70c93d
diff --git a/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts b/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts
index 9cd5d8c4d..1183b9737 100644
--- a/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts
+++ b/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts
@@ -12,7 +12,8 @@ import audio from "~~/test/playwright/utils/audio"
for (const dir of languageDirections) {
breakpoints.describeXs(async ({ expectSnapshot }) => {
- test(`Global audio player on the search page - ${dir}`, async ({
+ // https://github.com/WordPress/openverse/issues/3009
+ test.skip(`Global audio player on the search page - ${dir}`, async ({
page,
}) => {
await dismissTranslationBanner(page)
diff --git a/packages/eslint-plugin/src/rules/no-unexplained-disabled-test.ts b/packages/eslint-plugin/src/rules/no-unexplained-disabled-test.ts
index 91242eaca..bb76f56d8 100644
--- a/packages/eslint-plugin/src/rules/no-unexplained-disabled-test.ts
+++ b/packages/eslint-plugin/src/rules/no-unexplained-disabled-test.ts
@@ -25,9 +25,7 @@ export const noUnexplainedDisabledTest = OpenverseRule<[], MessageIds>({
create(context) {
const sourceCode = context.getSourceCode()
- const hasIssueCommentWithLink = (
- node: TSESTree.Node | TSESTree.Comment
- ) => {
+ const hasIssueCommentWithLink = (node: TSESTree.Node) => {
const commentsBeforeNode = sourceCode.getCommentsBefore(node)
for (const comment of commentsBeforeNode) {
if (/\bhttps:\/\/github\.com\/.*?\/issues\/\d+\b/.test(comment.value)) {
@@ -38,14 +36,14 @@ export const noUnexplainedDisabledTest = OpenverseRule<[], MessageIds>({
return false
}
- const testSkipRegex = /test\.skip\s*\(/g
- const testSkipEachRegex = /test\.skip\.each\s*\(/g
- const testConcurrentSkipEachRegex = /test\.concurrent\.skip\.each\s*\(/g
- const testTodoRegex = /test\.todo\s*\(/g
- const itSkipRegex = /it\.skip\s*\(/g
- const itEachSkipRegex = /it\.each\.skip\s*\(/g
- const describeSkipRegex = /describe\.skip\s*\(/g
- const describeEachSkipRegex = /describe\.each\.skip\s*\(/g
+ const testSkipRegex = /^test\.skip\s*\(/g
+ const testSkipEachRegex = /^test\.skip\.each\s*\(/g
+ const testConcurrentSkipEachRegex = /^test\.concurrent\.skip\.each\s*\(/g
+ const testTodoRegex = /^test\.todo\s*\(/g
+ const itSkipRegex = /^it\.skip\s*\(/g
+ const itEachSkipRegex = /^it\.each\.skip\s*\(/g
+ const describeSkipRegex = /^describe\.skip\s*\(/g
+ const describeEachSkipRegex = /^describe\.each\.skip\s*\(/g
return {
CallExpression(node) {
diff --git a/packages/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.ts b/packages/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.ts
index be0e44e6d..9eb484d17 100644
--- a/packages/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.ts
+++ b/packages/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.ts
@@ -50,6 +50,40 @@ const invalidTestCases = [
`,
errors: [{ messageId: "missingIssueComment" } as const],
},
+ {
+ name: "Nested blocks with multiple skipped tests shows multiple errors",
+ code: `
+ describe("block", () => {
+ test("no skipped", () => {})
+
+ test.skip("first skipped", () => {})
+
+ test("also not skipped", () => {})
+
+ test.skip("second skipped", () => {})
+ })
+ `,
+ errors: [
+ { messageId: "missingIssueComment" },
+ { messageId: "missingIssueComment" },
+ ] as const,
+ },
+ {
+ name: "Skipped external block and skipped nested block have separate errors",
+ code: `
+ test.skip("external skip", () => {})
+
+ describe("block", () => {
+ test("not skipped", () => {})
+
+ test.skip("nested skip", () => {})
+ })
+ `,
+ errors: [
+ { messageId: "missingIssueComment" },
+ { messageId: "missingIssueComment" },
+ ] as const,
+ },
]
const validTestCases = [
@@ -114,6 +148,29 @@ const validTestCases = [
})
`,
},
+ {
+ name: "Nested skip valid with comment on skipped test",
+ code: `
+ describe("group of tests", () => {
+ // https://github.com/WordPress/openverse/issues/2573
+ test.skip("skipped", () => {})
+ })
+ `,
+ },
+ {
+ name: "Nested and external blocks do not error",
+ code: `
+ // https://github.com/WordPress/openverse/issues/2573
+ test.skip("external skip", () => {})
+
+ describe("block", () => {
+ test("not skipped", () => {})
+
+ // https://github.com/WordPress/openverse/issues/2573
+ test.skip("nested skip", () => {})
+ })
+ `,
+ },
]
// Run the tests