mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 06:03:51 +03:00
Use vitest globals (#27102)
Enable [globals](https://vitest.dev/config/#globals) in vitest, reducing the noise in test files.
This commit is contained in:
parent
5ef5a0ade6
commit
ee27b94b2c
15 changed files with 13 additions and 11 deletions
|
@ -18,6 +18,7 @@ plugins:
|
||||||
- eslint-plugin-regexp
|
- eslint-plugin-regexp
|
||||||
- eslint-plugin-sonarjs
|
- eslint-plugin-sonarjs
|
||||||
- eslint-plugin-unicorn
|
- eslint-plugin-unicorn
|
||||||
|
- eslint-plugin-vitest-globals
|
||||||
- eslint-plugin-wc
|
- eslint-plugin-wc
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
@ -45,6 +46,9 @@ overrides:
|
||||||
- files: ["*.config.*"]
|
- files: ["*.config.*"]
|
||||||
rules:
|
rules:
|
||||||
import/no-unused-modules: [0]
|
import/no-unused-modules: [0]
|
||||||
|
- files: ["**/*.test.*", "web_src/js/test/setup.js"]
|
||||||
|
env:
|
||||||
|
vitest-globals/env: true
|
||||||
- files: ["web_src/js/modules/fetch.js", "web_src/js/standalone/**/*"]
|
- files: ["web_src/js/modules/fetch.js", "web_src/js/standalone/**/*"]
|
||||||
rules:
|
rules:
|
||||||
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
|
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
|
||||||
|
|
7
package-lock.json
generated
7
package-lock.json
generated
|
@ -67,6 +67,7 @@
|
||||||
"eslint-plugin-regexp": "1.15.0",
|
"eslint-plugin-regexp": "1.15.0",
|
||||||
"eslint-plugin-sonarjs": "0.21.0",
|
"eslint-plugin-sonarjs": "0.21.0",
|
||||||
"eslint-plugin-unicorn": "48.0.1",
|
"eslint-plugin-unicorn": "48.0.1",
|
||||||
|
"eslint-plugin-vitest-globals": "1.4.0",
|
||||||
"eslint-plugin-vue": "9.17.0",
|
"eslint-plugin-vue": "9.17.0",
|
||||||
"eslint-plugin-vue-scoped-css": "2.5.0",
|
"eslint-plugin-vue-scoped-css": "2.5.0",
|
||||||
"eslint-plugin-wc": "2.0.3",
|
"eslint-plugin-wc": "2.0.3",
|
||||||
|
@ -4963,6 +4964,12 @@
|
||||||
"eslint": ">=8.44.0"
|
"eslint": ">=8.44.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint-plugin-vitest-globals": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-plugin-vitest-globals/-/eslint-plugin-vitest-globals-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-WE+YlK9X9s4vf5EaYRU0Scw7WItDZStm+PapFSYlg2ABNtaQ4zIG7wEqpoUB3SlfM+SgkhgmzR0TeJOO5k3/Nw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/eslint-plugin-vue": {
|
"node_modules/eslint-plugin-vue": {
|
||||||
"version": "9.17.0",
|
"version": "9.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.17.0.tgz",
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
"eslint-plugin-regexp": "1.15.0",
|
"eslint-plugin-regexp": "1.15.0",
|
||||||
"eslint-plugin-sonarjs": "0.21.0",
|
"eslint-plugin-sonarjs": "0.21.0",
|
||||||
"eslint-plugin-unicorn": "48.0.1",
|
"eslint-plugin-unicorn": "48.0.1",
|
||||||
|
"eslint-plugin-vitest-globals": "1.4.0",
|
||||||
"eslint-plugin-vue": "9.17.0",
|
"eslint-plugin-vue": "9.17.0",
|
||||||
"eslint-plugin-vue-scoped-css": "2.5.0",
|
"eslint-plugin-vue-scoped-css": "2.5.0",
|
||||||
"eslint-plugin-wc": "2.0.3",
|
"eslint-plugin-wc": "2.0.3",
|
||||||
|
|
|
@ -11,6 +11,7 @@ export default defineConfig({
|
||||||
open: false,
|
open: false,
|
||||||
allowOnly: true,
|
allowOnly: true,
|
||||||
passWithNoTests: true,
|
passWithNoTests: true,
|
||||||
|
globals: true,
|
||||||
watch: false,
|
watch: false,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {test, expect} from 'vitest';
|
|
||||||
import {parseIssueListQuickGotoLink} from './common-issue-list.js';
|
import {parseIssueListQuickGotoLink} from './common-issue-list.js';
|
||||||
|
|
||||||
test('parseIssueListQuickGotoLink', () => {
|
test('parseIssueListQuickGotoLink', () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {test, expect} from 'vitest';
|
|
||||||
import {singleAnchorRegex, rangeAnchorRegex} from './repo-code.js';
|
import {singleAnchorRegex, rangeAnchorRegex} from './repo-code.js';
|
||||||
|
|
||||||
test('singleAnchorRegex', () => {
|
test('singleAnchorRegex', () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {describe, expect, test} from 'vitest';
|
|
||||||
import {strSubMatch, calcMatchedWeight, filterRepoFilesWeighted} from './repo-findfile.js';
|
import {strSubMatch, calcMatchedWeight, filterRepoFilesWeighted} from './repo-findfile.js';
|
||||||
|
|
||||||
describe('Repo Find Files', () => {
|
describe('Repo Find Files', () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {test, expect} from 'vitest';
|
|
||||||
import {GET, POST, PATCH, PUT, DELETE} from './fetch.js';
|
import {GET, POST, PATCH, PUT, DELETE} from './fetch.js';
|
||||||
|
|
||||||
// tests here are only to satisfy the linter for unused functions
|
// tests here are only to satisfy the linter for unused functions
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {test, expect} from 'vitest';
|
|
||||||
import {showInfoToast, showErrorToast, showWarningToast} from './toast.js';
|
import {showInfoToast, showErrorToast, showWarningToast} from './toast.js';
|
||||||
|
|
||||||
test('showInfoToast', async () => {
|
test('showInfoToast', async () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {expect, test} from 'vitest';
|
|
||||||
import {renderAnsi} from './ansi.js';
|
import {renderAnsi} from './ansi.js';
|
||||||
|
|
||||||
test('renderAnsi', () => {
|
test('renderAnsi', () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {expect, test} from 'vitest';
|
|
||||||
import {svg, SvgIcon, svgParseOuterInner} from './svg.js';
|
import {svg, SvgIcon, svgParseOuterInner} from './svg.js';
|
||||||
import {createApp, h} from 'vue';
|
import {createApp, h} from 'vue';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {expect, test} from 'vitest';
|
|
||||||
import {
|
import {
|
||||||
basename, extname, isObject, stripTags, parseIssueHref,
|
basename, extname, isObject, stripTags, parseIssueHref,
|
||||||
parseUrl, translateMonth, translateDay, blobToDataURI,
|
parseUrl, translateMonth, translateDay, blobToDataURI,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {test, expect} from 'vitest';
|
|
||||||
import {useLightTextOnBackground} from './color.js';
|
import {useLightTextOnBackground} from './color.js';
|
||||||
|
|
||||||
test('useLightTextOnBackground', () => {
|
test('useLightTextOnBackground', () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {test, expect} from 'vitest';
|
|
||||||
import {matchEmoji, matchMention} from './match.js';
|
import {matchEmoji, matchMention} from './match.js';
|
||||||
|
|
||||||
test('matchEmoji', () => {
|
test('matchEmoji', () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {expect, test} from 'vitest';
|
|
||||||
import {pathEscapeSegments} from './url.js';
|
import {pathEscapeSegments} from './url.js';
|
||||||
|
|
||||||
test('pathEscapeSegments', () => {
|
test('pathEscapeSegments', () => {
|
||||||
|
|
Loading…
Reference in a new issue