Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
63c6fc5f
Unverified
Commit
63c6fc5f
authored
Feb 27, 2020
by
Ryan McKinley
Committed by
GitHub
Feb 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toolkit: add junit reporting and jest.config.js to plugin build (#22450)
parent
62d86c95
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
3 deletions
+39
-3
packages/grafana-toolkit/src/cli/tasks/plugin/tests.ts
+2
-2
packages/grafana-toolkit/src/cli/tasks/toolkit.build.ts
+1
-0
packages/grafana-toolkit/src/config/jest.plugin.config.local.js
+8
-0
packages/grafana-toolkit/src/config/jest.plugin.config.ts
+28
-1
No files found.
packages/grafana-toolkit/src/cli/tasks/plugin/tests.ts
View file @
63c6fc5f
import
*
as
jestCLI
from
'jest-cli'
;
import
*
as
jestCLI
from
'jest-cli'
;
import
{
useSpinner
}
from
'../../utils/useSpinner'
;
import
{
useSpinner
}
from
'../../utils/useSpinner'
;
import
{
jest
Config
}
from
'../../../config/jest.plugin.config'
;
import
{
loadJestPlugin
Config
}
from
'../../../config/jest.plugin.config'
;
export
interface
PluginTestOptions
{
export
interface
PluginTestOptions
{
updateSnapshot
:
boolean
;
updateSnapshot
:
boolean
;
...
@@ -13,7 +13,7 @@ export interface PluginTestOptions {
...
@@ -13,7 +13,7 @@ export interface PluginTestOptions {
export
const
testPlugin
=
useSpinner
<
PluginTestOptions
>
(
export
const
testPlugin
=
useSpinner
<
PluginTestOptions
>
(
'Running tests'
,
'Running tests'
,
async
({
updateSnapshot
,
coverage
,
watch
,
testPathPattern
,
testNamePattern
})
=>
{
async
({
updateSnapshot
,
coverage
,
watch
,
testPathPattern
,
testNamePattern
})
=>
{
const
testConfig
=
jest
Config
();
const
testConfig
=
loadJestPlugin
Config
();
const
cliConfig
=
{
const
cliConfig
=
{
config
:
JSON
.
stringify
(
testConfig
),
config
:
JSON
.
stringify
(
testConfig
),
...
...
packages/grafana-toolkit/src/cli/tasks/toolkit.build.ts
View file @
63c6fc5f
...
@@ -60,6 +60,7 @@ const copyFiles = () => {
...
@@ -60,6 +60,7 @@ const copyFiles = () => {
'src/config/tsconfig.plugin.local.json'
,
'src/config/tsconfig.plugin.local.json'
,
'src/config/eslint.plugin.json'
,
'src/config/eslint.plugin.json'
,
'src/config/styles.mock.js'
,
'src/config/styles.mock.js'
,
'src/config/jest.plugin.config.local.js'
,
// plugin test file
// plugin test file
'src/plugins/e2e/commonPluginTests.ts'
,
'src/plugins/e2e/commonPluginTests.ts'
,
...
...
packages/grafana-toolkit/src/config/jest.plugin.config.local.js
0 → 100644
View file @
63c6fc5f
// This file is needed because it is used by vscode and other tools that
// call `jest` directly. However, unless you are doing anything special
// do not edit this file
const
standard
=
require
(
'@grafana/toolkit/src/config/jest.plugin.config'
);
// This process will use the same config that `yarn test` is using
module
.
exports
=
standard
.
jestConfig
();
packages/grafana-toolkit/src/config/jest.plugin.config.ts
View file @
63c6fc5f
...
@@ -57,9 +57,23 @@ export const jestConfig = (baseDir: string = process.cwd()) => {
...
@@ -57,9 +57,23 @@ export const jestConfig = (baseDir: string = process.cwd()) => {
moduleDirectories
:
[
'node_modules'
,
'src'
],
moduleDirectories
:
[
'node_modules'
,
'src'
],
moduleFileExtensions
:
[
'ts'
,
'tsx'
,
'js'
,
'jsx'
,
'json'
],
moduleFileExtensions
:
[
'ts'
,
'tsx'
,
'js'
,
'jsx'
,
'json'
],
setupFiles
,
setupFiles
,
globals
:
{
'ts-jest'
:
{
isolatedModules
:
true
}
},
globals
:
{
'ts-jest'
:
{
isolatedModules
:
true
,
tsConfig
:
path
.
resolve
(
baseDir
,
'tsconfig.json'
),
},
},
coverageReporters
:
[
'json-summary'
,
'text'
,
'lcov'
],
coverageReporters
:
[
'json-summary'
,
'text'
,
'lcov'
],
collectCoverageFrom
:
[
'src/**/*.{ts,tsx}'
,
'!**/node_modules/**'
,
'!**/vendor/**'
],
collectCoverageFrom
:
[
'src/**/*.{ts,tsx}'
,
'!**/node_modules/**'
,
'!**/vendor/**'
],
reporters
:
[
'default'
,
[
'jest-junit'
,
{
outputDirectory
:
'coverage'
,
},
],
],
testMatch
:
[
testMatch
:
[
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}'
,
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}'
,
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'
,
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'
,
...
@@ -80,3 +94,16 @@ export const jestConfig = (baseDir: string = process.cwd()) => {
...
@@ -80,3 +94,16 @@ export const jestConfig = (baseDir: string = process.cwd()) => {
...
otherOverrides
,
...
otherOverrides
,
};
};
};
};
/**
* This will load the existing just setup, or use the default if it exists
*/
export
const
loadJestPluginConfig
=
(
baseDir
:
string
=
process
.
cwd
())
=>
{
const
cfgpath
=
path
.
resolve
(
baseDir
,
'jest.config.js'
);
if
(
!
fs
.
existsSync
(
cfgpath
))
{
const
src
=
path
.
resolve
(
baseDir
,
'node_modules/@grafana/toolkit/src/config/jest.plugin.config.local.js'
);
fs
.
copyFileSync
(
src
,
cfgpath
);
console
.
log
(
'Using standard jest plugin config'
,
src
);
}
return
require
(
cfgpath
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment