chore: ensure no `.only` is commited in test files

`.only` is only to be used for development, but must not be committed.
Instead failing tests which should be kept for later should be skipped
(`.skip`).

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/55791/head
Ferdinand Thiessen 2025-10-15 16:00:01 +07:00
parent 65cdf14667
commit 3cf210a9a5
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
4 changed files with 34 additions and 5 deletions

@ -77,7 +77,7 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
getRowForFile('original folder').should('not.exist')
})
it.only('Can move a file to its parent folder', () => {
it('Can move a file to its parent folder', () => {
cy.mkdir(currentUser, '/new-folder')
cy.uploadContent(currentUser, new Blob(), 'text/plain', '/new-folder/original.txt')
cy.login(currentUser)

@ -6,6 +6,7 @@
import { includeIgnoreFile } from '@eslint/compat'
import { recommendedVue2 } from '@nextcloud/eslint-config'
import CypressEslint from 'eslint-plugin-cypress'
import noOnlyTests from 'eslint-plugin-no-only-tests'
import { defineConfig } from 'eslint/config'
import * as globals from 'globals'
import { fileURLToPath } from 'node:url'
@ -22,9 +23,7 @@ export default defineConfig([
...recommendedVue2,
// respect .gitignore
includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
// add globals configuration for Webpack injected variables
{
name: 'server/custom-webpack-globals',
files: ['**/*.js', '**/*.ts', '**/*.vue'],
@ -35,6 +34,7 @@ export default defineConfig([
},
},
// Ensure that cjs files are treated as Node scripts
{
name: 'server/scripts-are-cjs',
files: [
@ -55,6 +55,7 @@ export default defineConfig([
'jsdoc/require-jsdoc': 'off',
},
},
// Cypress setup
{
...CypressEslint.configs.recommended,
@ -72,7 +73,23 @@ export default defineConfig([
'@typescript-eslint/no-unused-expressions': 'off',
},
},
// customer server ignore files
// Forbid commiting .only in test files (skipping tests is very unexpected)
{
name: 'server/no-only-in-tests',
files: ['cypress/**', 'apps/**/*.spec.*', 'core/**/*.spec.*'],
plugins: {
'no-only-tests': noOnlyTests,
},
rules: {
'no-only-tests/no-only-tests': 'error',
},
},
// respect .gitignore
includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
// custom server ignore files
{
name: 'server/ignored-files',
ignores: [

11
package-lock.json generated

@ -123,6 +123,7 @@
"dockerode": "^4.0.9",
"eslint": "^9.36.0",
"eslint-plugin-cypress": "^5.1.1",
"eslint-plugin-no-only-tests": "^3.3.0",
"exports-loader": "^5.0.0",
"file-loader": "^6.2.0",
"handlebars-loader": "^1.7.3",
@ -11766,6 +11767,16 @@
"node": ">=10"
}
},
"node_modules/eslint-plugin-no-only-tests": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-3.3.0.tgz",
"integrity": "sha512-brcKcxGnISN2CcVhXJ/kEQlNa0MEfGRtwKtWA16SkqXHKitaKIMrfemJKLKX1YqDU5C/5JY3PvZXd5jEW04e0Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=5.0.0"
}
},
"node_modules/eslint-plugin-perfectionist": {
"version": "4.15.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-perfectionist/-/eslint-plugin-perfectionist-4.15.0.tgz",

@ -157,6 +157,7 @@
"dockerode": "^4.0.9",
"eslint": "^9.36.0",
"eslint-plugin-cypress": "^5.1.1",
"eslint-plugin-no-only-tests": "^3.3.0",
"exports-loader": "^5.0.0",
"file-loader": "^6.2.0",
"handlebars-loader": "^1.7.3",