mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
web: extract testing package (#45812)
This commit is contained in:
parent
d5fbcbe7f9
commit
9db57c1df8
@ -17,6 +17,7 @@ client/search-ui/node_modules
|
||||
client/shared/node_modules
|
||||
client/storybook/node_modules
|
||||
client/template-parser/node_modules
|
||||
client/testing/node_modules
|
||||
client/web/node_modules
|
||||
client/wildcard/node_modules
|
||||
client/vscode/node_modules
|
||||
|
||||
@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event'
|
||||
import { act } from 'react-dom/test-utils'
|
||||
import { spy, assert, useFakeTimers } from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { NOOP_TELEMETRY_SERVICE } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { MockIntersectionObserver } from '@sourcegraph/shared/src/testing/MockIntersectionObserver'
|
||||
import {
|
||||
@ -11,6 +10,7 @@ import {
|
||||
mockGetUserSearchContextNamespaces,
|
||||
} from '@sourcegraph/shared/src/testing/searchContexts/testHelpers'
|
||||
import { NOOP_PLATFORM_CONTEXT } from '@sourcegraph/shared/src/testing/searchTestHelpers'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
|
||||
import { SearchContextDropdown, SearchContextDropdownProps } from './SearchContextDropdown'
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@ import { screen, within } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { Progress } from '@sourcegraph/shared/src/search/stream'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing'
|
||||
|
||||
import { StreamingProgressSkippedPopover } from './StreamingProgressSkippedPopover'
|
||||
|
||||
@ -3,9 +3,9 @@ import userEvent from '@testing-library/user-event'
|
||||
import * as H from 'history'
|
||||
import { NEVER } from 'rxjs'
|
||||
|
||||
import { assertAriaEnabled } from '@sourcegraph/testing'
|
||||
import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing'
|
||||
|
||||
import { assertAriaEnabled } from '../../dev/aria-asserts'
|
||||
import { createBarrier } from '../api/integration-test/testHelpers'
|
||||
import { NOOP_TELEMETRY_SERVICE } from '../telemetry/telemetryService'
|
||||
|
||||
|
||||
1
client/testing/.eslintignore
Normal file
1
client/testing/.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
out/
|
||||
12
client/testing/.eslintrc.js
Normal file
12
client/testing/.eslintrc.js
Normal file
@ -0,0 +1,12 @@
|
||||
// @ts-check
|
||||
|
||||
const baseConfig = require('../../.eslintrc.js')
|
||||
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
parserOptions: {
|
||||
...baseConfig.parserOptions,
|
||||
project: [__dirname + '/tsconfig.json'],
|
||||
},
|
||||
overrides: baseConfig.overrides,
|
||||
}
|
||||
4
client/testing/README.md
Normal file
4
client/testing/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Tools for writing tests
|
||||
|
||||
Package-agnostic utilities for unit and integration tests.
|
||||
App or package-specific utilities should live in `client/{packageName}/src/testing`.
|
||||
5
client/testing/babel.config.js
Normal file
5
client/testing/babel.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
module.exports = {
|
||||
extends: '../../babel.config.js',
|
||||
}
|
||||
13
client/testing/jest.config.js
Normal file
13
client/testing/jest.config.js
Normal file
@ -0,0 +1,13 @@
|
||||
// @ts-check
|
||||
|
||||
const config = require('../../jest.config.base')
|
||||
|
||||
const exportedConfig = {
|
||||
...config,
|
||||
displayName: 'testing',
|
||||
rootDir: __dirname,
|
||||
roots: ['<rootDir>'],
|
||||
verbose: true,
|
||||
}
|
||||
|
||||
module.exports = exportedConfig
|
||||
13
client/testing/package.json
Normal file
13
client/testing/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@sourcegraph/testing",
|
||||
"version": "0.0.1",
|
||||
"description": "Sourcegraph testing API",
|
||||
"main": "./src/index.ts",
|
||||
"sideEffects": false,
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"lint:js": "yarn run -T eslint --cache 'src/**/*.[jt]s?(x)'",
|
||||
"test": "yarn run -T jest"
|
||||
}
|
||||
}
|
||||
1
client/testing/src/index.ts
Normal file
1
client/testing/src/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './aria-asserts'
|
||||
13
client/testing/tsconfig.json
Normal file
13
client/testing/tsconfig.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"references": [{ "path": "../common" }],
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"module": "commonjs",
|
||||
"sourceRoot": "src",
|
||||
"rootDir": ".",
|
||||
"outDir": "./out",
|
||||
"baseUrl": "./src",
|
||||
},
|
||||
"include": ["./src/**/*", "./*.ts"],
|
||||
}
|
||||
@ -4,8 +4,8 @@ import * as H from 'history'
|
||||
import { NEVER, of } from 'rxjs'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { MockedTestProvider } from '@sourcegraph/shared/src/testing/apollo'
|
||||
import { assertAriaDisabled } from '@sourcegraph/testing'
|
||||
import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing'
|
||||
|
||||
import { AuthenticatedUser } from '../../auth'
|
||||
|
||||
@ -4,8 +4,8 @@ import * as H from 'history'
|
||||
import { NEVER, of } from 'rxjs'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { MockedTestProvider } from '@sourcegraph/shared/src/testing/apollo'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing'
|
||||
|
||||
import {
|
||||
|
||||
@ -2,8 +2,8 @@ import { fireEvent, getByRole, screen } from '@testing-library/react'
|
||||
import { createMemoryHistory, createLocation } from 'history'
|
||||
import { NEVER } from 'rxjs'
|
||||
|
||||
import { assertAriaDisabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { MockedTestProvider } from '@sourcegraph/shared/src/testing/apollo'
|
||||
import { assertAriaDisabled } from '@sourcegraph/testing'
|
||||
import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing'
|
||||
|
||||
import { mockAuthenticatedUser, mockCodeMonitorFields } from '../testing/util'
|
||||
|
||||
@ -2,7 +2,7 @@ import { render } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { assertAriaDisabled } from '@sourcegraph/testing'
|
||||
|
||||
import { ActionEditor, ActionEditorProps } from './ActionEditor'
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@ import { render } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { MockedTestProvider, waitForNextApolloResponse } from '@sourcegraph/shared/src/testing/apollo'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
|
||||
import { MonitorEmailPriority, SendTestEmailResult, SendTestEmailVariables } from '../../../../graphql-operations'
|
||||
import { mockAuthenticatedUser } from '../../testing/util'
|
||||
|
||||
@ -3,8 +3,8 @@ import { render } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { MockedTestProvider, waitForNextApolloResponse } from '@sourcegraph/shared/src/testing/apollo'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
|
||||
import { SendTestSlackWebhookResult, SendTestSlackWebhookVariables } from '../../../../graphql-operations'
|
||||
import { mockAuthenticatedUser } from '../../testing/util'
|
||||
|
||||
@ -3,8 +3,8 @@ import { render } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { MockedTestProvider, waitForNextApolloResponse } from '@sourcegraph/shared/src/testing/apollo'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
|
||||
import { SendTestWebhookResult, SendTestWebhookVariables } from '../../../../graphql-operations'
|
||||
import { mockAuthenticatedUser } from '../../testing/util'
|
||||
|
||||
@ -2,7 +2,7 @@ import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
|
||||
import { Button } from '../../Button'
|
||||
import { PopoverTrigger } from '../../Popover'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { render, RenderResult, cleanup, fireEvent } from '@testing-library/react'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/shared/dev/aria-asserts'
|
||||
import { assertAriaDisabled, assertAriaEnabled } from '@sourcegraph/testing'
|
||||
|
||||
import { PageSwitcher, PageSwitcherProps } from './PageSwitcher'
|
||||
|
||||
|
||||
@ -8,12 +8,7 @@
|
||||
"baseUrl": "./src",
|
||||
"jsx": "react-jsx",
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../shared" },
|
||||
{ "path": "../branded" },
|
||||
{ "path": "../../schema" },
|
||||
{ "path": "../common" },
|
||||
],
|
||||
"references": [{ "path": "../branded" }, { "path": "../common" }, { "path": "../testing" }],
|
||||
"include": ["**/*", ".*"],
|
||||
"exclude": ["../../node_modules", "./node_modules", "./out"],
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ DIRS=(
|
||||
client/shared
|
||||
client/storybook
|
||||
client/template-parser
|
||||
client/testing
|
||||
client/vscode
|
||||
client/web
|
||||
client/wildcard
|
||||
|
||||
@ -848,6 +848,9 @@ importers:
|
||||
client/template-parser:
|
||||
specifiers: {}
|
||||
|
||||
client/testing:
|
||||
specifiers: {}
|
||||
|
||||
client/vscode:
|
||||
specifiers:
|
||||
vsce: ^2.7.0
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
{ "path": "client/storybook" },
|
||||
{ "path": "client/search" },
|
||||
{ "path": "client/search-ui" },
|
||||
{ "path": "client/testing" },
|
||||
{ "path": "dev/release" },
|
||||
{ "path": "schema" },
|
||||
{ "path": "client/codeintellify" },
|
||||
|
||||
@ -5519,6 +5519,12 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@sourcegraph/testing@workspace:client/testing":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@sourcegraph/testing@workspace:client/testing"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@sourcegraph/tsconfig@npm:^4.0.1":
|
||||
version: 4.0.1
|
||||
resolution: "@sourcegraph/tsconfig@npm:4.0.1"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user