Files
ai-course/node_modules/eslint-plugin-jest/docs/rules/no-export.md
KQL ce6aa207e9 fix: 修复图片路径以适配GitHub Pages base path
- 将所有图片路径从绝对路径改为使用 process.env.PUBLIC_URL
- 修复 HomePage.tsx 中所有图片引用
- 修复 CoursePage.tsx 中所有图片引用
- 确保图片在 GitHub Pages 上正确加载

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 09:24:45 +08:00

992 B

Disallow using exports in files containing tests (no-export)

Prevents using exports if a file has one or more tests in it.

Rule Details

This rule aims to eliminate duplicate runs of tests by exporting things from test files. If you import from a test file, then all the tests in that file will be run in each imported instance, so bottom line, don't export from a test, but instead move helper functions into a separate file when they need to be shared across tests.

Examples of incorrect code for this rule:

export function myHelper() {}

module.exports = function () {};

module.exports = {
  something: 'that should be moved to a non-test file',
};

describe('a test', () => {
  expect(1).toBe(1);
});

Examples of correct code for this rule:

function myHelper() {}

const myThing = {
  something: 'that can live here',
};

describe('a test', () => {
  expect(1).toBe(1);
});

When Not To Use It

Don't use this rule on non-jest test files.