loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use vitest globals (#27102)

Enable [globals](https://vitest.dev/config/#globals) in vitest, reducing
the noise in test files.

authored by

silverwind and committed by
GitHub
ee27b94b 5ef5a0ad

+13 -11
+4
.eslintrc.yaml
··· 18 18 - eslint-plugin-regexp 19 19 - eslint-plugin-sonarjs 20 20 - eslint-plugin-unicorn 21 + - eslint-plugin-vitest-globals 21 22 - eslint-plugin-wc 22 23 23 24 env: ··· 45 46 - files: ["*.config.*"] 46 47 rules: 47 48 import/no-unused-modules: [0] 49 + - files: ["**/*.test.*", "web_src/js/test/setup.js"] 50 + env: 51 + vitest-globals/env: true 48 52 - files: ["web_src/js/modules/fetch.js", "web_src/js/standalone/**/*"] 49 53 rules: 50 54 no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
+7
package-lock.json
··· 67 67 "eslint-plugin-regexp": "1.15.0", 68 68 "eslint-plugin-sonarjs": "0.21.0", 69 69 "eslint-plugin-unicorn": "48.0.1", 70 + "eslint-plugin-vitest-globals": "1.4.0", 70 71 "eslint-plugin-vue": "9.17.0", 71 72 "eslint-plugin-vue-scoped-css": "2.5.0", 72 73 "eslint-plugin-wc": "2.0.3", ··· 4962 4963 "peerDependencies": { 4963 4964 "eslint": ">=8.44.0" 4964 4965 } 4966 + }, 4967 + "node_modules/eslint-plugin-vitest-globals": { 4968 + "version": "1.4.0", 4969 + "resolved": "https://registry.npmjs.org/eslint-plugin-vitest-globals/-/eslint-plugin-vitest-globals-1.4.0.tgz", 4970 + "integrity": "sha512-WE+YlK9X9s4vf5EaYRU0Scw7WItDZStm+PapFSYlg2ABNtaQ4zIG7wEqpoUB3SlfM+SgkhgmzR0TeJOO5k3/Nw==", 4971 + "dev": true 4965 4972 }, 4966 4973 "node_modules/eslint-plugin-vue": { 4967 4974 "version": "9.17.0",
+1
package.json
··· 66 66 "eslint-plugin-regexp": "1.15.0", 67 67 "eslint-plugin-sonarjs": "0.21.0", 68 68 "eslint-plugin-unicorn": "48.0.1", 69 + "eslint-plugin-vitest-globals": "1.4.0", 69 70 "eslint-plugin-vue": "9.17.0", 70 71 "eslint-plugin-vue-scoped-css": "2.5.0", 71 72 "eslint-plugin-wc": "2.0.3",
+1
vitest.config.js
··· 11 11 open: false, 12 12 allowOnly: true, 13 13 passWithNoTests: true, 14 + globals: true, 14 15 watch: false, 15 16 }, 16 17 plugins: [
-1
web_src/js/features/common-issue-list.test.js
··· 1 - import {test, expect} from 'vitest'; 2 1 import {parseIssueListQuickGotoLink} from './common-issue-list.js'; 3 2 4 3 test('parseIssueListQuickGotoLink', () => {
-1
web_src/js/features/repo-code.test.js
··· 1 - import {test, expect} from 'vitest'; 2 1 import {singleAnchorRegex, rangeAnchorRegex} from './repo-code.js'; 3 2 4 3 test('singleAnchorRegex', () => {
-1
web_src/js/features/repo-findfile.test.js
··· 1 - import {describe, expect, test} from 'vitest'; 2 1 import {strSubMatch, calcMatchedWeight, filterRepoFilesWeighted} from './repo-findfile.js'; 3 2 4 3 describe('Repo Find Files', () => {
-1
web_src/js/modules/fetch.test.js
··· 1 - import {test, expect} from 'vitest'; 2 1 import {GET, POST, PATCH, PUT, DELETE} from './fetch.js'; 3 2 4 3 // tests here are only to satisfy the linter for unused functions
-1
web_src/js/modules/toast.test.js
··· 1 - import {test, expect} from 'vitest'; 2 1 import {showInfoToast, showErrorToast, showWarningToast} from './toast.js'; 3 2 4 3 test('showInfoToast', async () => {
-1
web_src/js/render/ansi.test.js
··· 1 - import {expect, test} from 'vitest'; 2 1 import {renderAnsi} from './ansi.js'; 3 2 4 3 test('renderAnsi', () => {
-1
web_src/js/svg.test.js
··· 1 - import {expect, test} from 'vitest'; 2 1 import {svg, SvgIcon, svgParseOuterInner} from './svg.js'; 3 2 import {createApp, h} from 'vue'; 4 3
-1
web_src/js/utils.test.js
··· 1 - import {expect, test} from 'vitest'; 2 1 import { 3 2 basename, extname, isObject, stripTags, parseIssueHref, 4 3 parseUrl, translateMonth, translateDay, blobToDataURI,
-1
web_src/js/utils/color.test.js
··· 1 - import {test, expect} from 'vitest'; 2 1 import {useLightTextOnBackground} from './color.js'; 3 2 4 3 test('useLightTextOnBackground', () => {
-1
web_src/js/utils/match.test.js
··· 1 - import {test, expect} from 'vitest'; 2 1 import {matchEmoji, matchMention} from './match.js'; 3 2 4 3 test('matchEmoji', () => {
-1
web_src/js/utils/url.test.js
··· 1 - import {expect, test} from 'vitest'; 2 1 import {pathEscapeSegments} from './url.js'; 3 2 4 3 test('pathEscapeSegments', () => {