docsify/jest.config.js
Joe Pea 136e666e78 Merge branch 'develop' into fix-validating-remote-content-2
* develop: (104 commits)
  chore: bump ssri from 6.0.1 to 6.0.2 (#1563)
  chore: Update Edit Document using develop branch (#1541)
  fix: Add escapeHtml for search (#1551)
  docs: link with plugin Pagination (#1554)
  fix: Upgrade dompurify from 2.2.6 to 2.2.7 (#1553)
  fix: upgrade dompurify from 2.2.6 to 2.2.7 (#1552)
  chore: bump y18n from 4.0.0 to 4.0.1 (#1548)
  chore: Fix search for missing pathNamespaces (#1547)
  fix: Upgrade docsify from 4.12.0 to 4.12.1 (#1544)
  docs:Update deploy, change Zeit to Vercel (#1540)
  fix: Cannot read property 'classList' of null (#1527)
  chore: fix microsoft/playwright-github-action error (#1534)
  Update PULL_REQUEST_TEMPLATE.md
  chore: Update CHANGELOG and Update test snapshots
  chore: add changelog 4.12.1
  [build] 4.12.1
  feat: Support search when there is no title (#1519)
  test(unit): add test cases on isExternal. (#1515)
  docs: Update Vercel logo link (#1520)
  fix: Upgrade docsify from 4.11.6 to 4.12.0 (#1518)
  ...
2021-05-04 01:59:38 -07:00

75 lines
2.0 KiB
JavaScript

import { TEST_HOST } from './test/config/server.js';
const sharedConfig = {
errorOnDeprecated: true,
globals: {
TEST_HOST,
},
globalSetup: './test/config/jest.setup.cjs',
globalTeardown: './test/config/jest.teardown.cjs',
resetModules: true,
restoreMocks: true,
};
// Jest configuration: https://jestjs.io/docs/en/configuration
// Jest is configured for us to write our code as native ES Modules. See
// https://github.com/facebook/jest/issues/9430 and
// https://jestjs.io/docs/en/ecmascript-modules.
export default {
// Disable transforms, we'll write plain JS. This is needed for native
// ESM
transform: {},
// Adding globals to config root for easier importing into .eslint.cjs, but
// as of Jest 26.4.2 these globals need to be added to each project config
// as well.
globals: sharedConfig.globals,
projects: [
// Unit Tests (Jest)
{
...sharedConfig,
displayName: 'unit',
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
testMatch: [
'<rootDir>/test/unit/**/*.test.js',
'<rootDir>/packages/docsify-server-renderer/src/**/*.test.js',
],
testURL: `${TEST_HOST}/_blank.html`,
},
// Integration Tests (Jest)
{
...sharedConfig,
displayName: 'integration',
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
testMatch: ['<rootDir>/test/integration/*.test.js'],
testURL: `${TEST_HOST}/_blank.html`,
},
// E2E Tests (Jest + Playwright)
{
...sharedConfig,
displayName: 'e2e',
preset: 'jest-playwright-preset',
setupFilesAfterEnv: [
'<rootDir>/test/config/jest-playwright.setup-tests.js',
],
testEnvironmentOptions: {
'jest-playwright': {
// prettier-ignore
browsers: [
'chromium',
'firefox',
'webkit',
],
launchOptions: {
// headless: false,
// devtools: true,
},
},
},
testMatch: ['<rootDir>/test/e2e/*.test.js'],
},
],
};