Tests: Isolate script tests to prevent jest errors locally (#84881)

* test(jest): isolate script tests to prevent jest errors in grafana-server/tmp tests

* chore(codeowners): update so generate-transformations matches in docs and tests directory
This commit is contained in:
Jack Westbrook
2024-03-21 11:36:37 +01:00
committed by GitHub
parent 473898e47c
commit f67e56939a
3 changed files with 7 additions and 7 deletions

4
.github/CODEOWNERS vendored
View File

@@ -535,7 +535,7 @@ playwright.config.ts @grafana/plugins-platform-frontend
/scripts/generate-icon-bundle.js @grafana/plugins-platform-frontend @grafana/grafana-frontend-platform
/scripts/levitate-parse-json-report.js @grafana/plugins-platform-frontend
/scripts/docs/generate-transformations* @grafana/dataviz-squad
/scripts/**/generate-transformations* @grafana/dataviz-squad
/scripts/webpack/ @grafana/frontend-ops
/scripts/generate-a11y-report.sh @grafana/grafana-frontend-platform
.pa11yci.conf.js @grafana/grafana-frontend-platform
@@ -614,7 +614,7 @@ playwright.config.ts @grafana/plugins-platform-frontend
/pkg/services/cloudmigration/ @grafana/grafana-operator-experience-squad
# Feature toggles
/pkg/services/featuremgmt/ @grafana/grafana-backend-services-squad
/pkg/services/featuremgmt/ @grafana/grafana-backend-services-squad
# Kind definitions

View File

@@ -30,7 +30,7 @@ module.exports = {
`/node_modules/(?!${esModules})`, // exclude es modules to prevent TS complaining
],
moduleDirectories: ['public', 'node_modules'],
roots: ['<rootDir>/public/app', '<rootDir>/public/test', '<rootDir>/packages', '<rootDir>/scripts'],
roots: ['<rootDir>/public/app', '<rootDir>/public/test', '<rootDir>/packages', '<rootDir>/scripts/tests'],
testRegex: '(\\.|/)(test)\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
setupFiles: ['jest-canvas-mock', './public/test/jest-setup.ts'],

View File

@@ -1,4 +1,4 @@
import { getMarkdownContent, getJavaScriptContent } from './generate-transformations.ts';
import { getMarkdownContent, getJavaScriptContent } from '../docs/generate-transformations.ts';
describe('makefile script tests', () => {
// If these tests fail, refer to `./docs/README.md` "Content guidelines" for more information
@@ -22,8 +22,8 @@ export function contentDoesMatch(jsContent: string, mdContent: string): Boolean
return normalizeContent(jsContent) === normalizeContent(mdContent);
}
/*
Normalize content by removing all whitespace (spaces, tabs, newlines, carriage returns,
/*
Normalize content by removing all whitespace (spaces, tabs, newlines, carriage returns,
form feeds, and vertical tabs) and special characters.
NOTE: There are numerous unpredictable formatting oddities when transforming JavaScript to Markdown;
@@ -51,7 +51,7 @@ export function contentDoesMatch(jsContent: string, mdContent: string): Boolean
| 4 | 6 | 8 |
| 5 | 7 | 9 |
This is one of many arbitrary formatting anomalies that we can ignore by normalizing the
This is one of many arbitrary formatting anomalies that we can ignore by normalizing the
content before comparing the JavaScript template literals and the final Markdown.
*/
function normalizeContent(content: string): string {