Skip to content

Commit 50f2874

Browse files
authored
Merge pull request #55791 from nextcloud/chore/ensure-no-only
chore: ensure no `.only` is commited in test files
2 parents 65cdf14 + 3cf210a commit 50f2874

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

cypress/e2e/files/files-copy-move.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
7777
getRowForFile('original folder').should('not.exist')
7878
})
7979

80-
it.only('Can move a file to its parent folder', () => {
80+
it('Can move a file to its parent folder', () => {
8181
cy.mkdir(currentUser, '/new-folder')
8282
cy.uploadContent(currentUser, new Blob(), 'text/plain', '/new-folder/original.txt')
8383
cy.login(currentUser)

eslint.config.mjs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { includeIgnoreFile } from '@eslint/compat'
77
import { recommendedVue2 } from '@nextcloud/eslint-config'
88
import CypressEslint from 'eslint-plugin-cypress'
9+
import noOnlyTests from 'eslint-plugin-no-only-tests'
910
import { defineConfig } from 'eslint/config'
1011
import * as globals from 'globals'
1112
import { fileURLToPath } from 'node:url'
@@ -22,9 +23,7 @@ export default defineConfig([
2223

2324
...recommendedVue2,
2425

25-
// respect .gitignore
26-
includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
27-
26+
// add globals configuration for Webpack injected variables
2827
{
2928
name: 'server/custom-webpack-globals',
3029
files: ['**/*.js', '**/*.ts', '**/*.vue'],
@@ -35,6 +34,7 @@ export default defineConfig([
3534
},
3635
},
3736

37+
// Ensure that cjs files are treated as Node scripts
3838
{
3939
name: 'server/scripts-are-cjs',
4040
files: [
@@ -55,6 +55,7 @@ export default defineConfig([
5555
'jsdoc/require-jsdoc': 'off',
5656
},
5757
},
58+
5859
// Cypress setup
5960
{
6061
...CypressEslint.configs.recommended,
@@ -72,7 +73,23 @@ export default defineConfig([
7273
'@typescript-eslint/no-unused-expressions': 'off',
7374
},
7475
},
75-
// customer server ignore files
76+
77+
// Forbid commiting .only in test files (skipping tests is very unexpected)
78+
{
79+
name: 'server/no-only-in-tests',
80+
files: ['cypress/**', 'apps/**/*.spec.*', 'core/**/*.spec.*'],
81+
plugins: {
82+
'no-only-tests': noOnlyTests,
83+
},
84+
rules: {
85+
'no-only-tests/no-only-tests': 'error',
86+
},
87+
},
88+
89+
// respect .gitignore
90+
includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
91+
92+
// custom server ignore files
7693
{
7794
name: 'server/ignored-files',
7895
ignores: [

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
"dockerode": "^4.0.9",
158158
"eslint": "^9.36.0",
159159
"eslint-plugin-cypress": "^5.1.1",
160+
"eslint-plugin-no-only-tests": "^3.3.0",
160161
"exports-loader": "^5.0.0",
161162
"file-loader": "^6.2.0",
162163
"handlebars-loader": "^1.7.3",

0 commit comments

Comments
 (0)