jest.config.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // For a detailed explanation regarding each configuration property and type check, visit:
  2. // https://jestjs.io/docs/en/configuration.html
  3. module.exports = {
  4. preset: 'jest-puppeteer',
  5. // All imported modules in your tests should be mocked automatically
  6. // automock: false,
  7. // Automatically clear mock calls and instances between every test
  8. clearMocks: true,
  9. // An object that configures minimum threshold enforcement for coverage results
  10. // coverageThreshold: undefined,
  11. // A set of global variables that need to be available in all test environments
  12. globals: {
  13. PATH: 'http://localhost:9811'
  14. },
  15. // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
  16. // maxWorkers: "50%",
  17. // An array of directory names to be searched recursively up from the requiring module's location
  18. // moduleDirectories: [
  19. // "node_modules"
  20. // ],
  21. // An array of file extensions your modules use
  22. moduleFileExtensions: [
  23. 'js',
  24. 'json',
  25. 'jsx',
  26. 'ts',
  27. 'tsx',
  28. 'node'
  29. ],
  30. // The root directory that Jest should scan for tests and modules within
  31. // rootDir: undefined,
  32. // A list of paths to directories that Jest should use to search for files in
  33. roots: [
  34. '<rootDir>'
  35. ],
  36. // Allows you to use a custom runner instead of Jest's default test runner
  37. // runner: "jest-runner",
  38. // The paths to modules that run some code to configure or set up the testing environment before each test
  39. // setupFiles: [],
  40. // A list of paths to modules that run some code to configure or set up the testing framework before each test
  41. // setupFilesAfterEnv: [],
  42. // The number of seconds after which a test is considered as slow and reported as such in the results.
  43. // slowTestThreshold: 5,
  44. // A list of paths to snapshot serializer modules Jest should use for snapshot testing
  45. // snapshotSerializers: [],
  46. // The test environment that will be used for testing
  47. // testEnvironment: 'jsdom',
  48. // Options that will be passed to the testEnvironment
  49. // testEnvironmentOptions: {},
  50. // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
  51. testPathIgnorePatterns: [
  52. '/node_modules/'
  53. ],
  54. // The regexp pattern or array of patterns that Jest uses to detect test files
  55. testRegex: '.(.+)\\.test\\.(js|ts)$',
  56. // This option allows the use of a custom results processor
  57. // testResultsProcessor: undefined,
  58. // This option allows use of a custom test runner
  59. // testRunner: "jest-circus/runner",
  60. // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
  61. testURL: 'http://localhost:9898/',
  62. // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
  63. // timers: "real",
  64. // A map from regular expressions to paths to transformers
  65. transform: {
  66. '^.+\\.js$': 'babel-jest'
  67. },
  68. // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
  69. transformIgnorePatterns: [
  70. '/node_modules/',
  71. '\\.pnp\\.[^\\/]+$'
  72. ],
  73. // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
  74. // unmockedModulePathPatterns: undefined,
  75. // Indicates whether each individual test should be reported during the run
  76. verbose: true,
  77. // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
  78. // watchPathIgnorePatterns: [],
  79. // Whether to use watchman for file crawling
  80. // watchman: true,
  81. testTimeout: 50000
  82. };