Skip to content

Commit 1b205be

Browse files
committed
fix: avoid depending on central mock files
1 parent 7f473ec commit 1b205be

15 files changed

+325
-20
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
export default {
2+
upload: {
3+
organization: 'code-pushup',
4+
project: 'cli-js',
5+
apiKey: 'e2e-api-key',
6+
server: 'https://e2e.com/api',
7+
},
8+
categories: [
9+
{
10+
slug: 'category-1',
11+
title: 'Category 1',
12+
refs: [
13+
{
14+
type: 'audit',
15+
plugin: 'node',
16+
slug: 'node-version',
17+
weight: 1,
18+
},
19+
],
20+
},
21+
],
22+
plugins: [
23+
{
24+
audits: [
25+
{
26+
slug: 'node-version',
27+
title: 'Node version',
28+
description: 'prints node version to file',
29+
docsUrl: 'https://nodejs.org/',
30+
},
31+
],
32+
runner: {
33+
command: 'node',
34+
args: ['-v'],
35+
outputFile: 'output.json',
36+
},
37+
groups: [],
38+
slug: 'node',
39+
title: 'Node.js',
40+
icon: 'javascript',
41+
},
42+
],
43+
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
export default {
2+
upload: {
3+
organization: 'code-pushup',
4+
project: 'cli-mjs',
5+
apiKey: 'e2e-api-key',
6+
server: 'https://e2e.com/api',
7+
},
8+
categories: [
9+
{
10+
slug: 'category-1',
11+
title: 'Category 1',
12+
refs: [
13+
{
14+
type: 'audit',
15+
plugin: 'node',
16+
slug: 'node-version',
17+
weight: 1,
18+
},
19+
],
20+
},
21+
],
22+
plugins: [
23+
{
24+
audits: [
25+
{
26+
slug: 'node-version',
27+
title: 'Node version',
28+
description: 'prints node version to file',
29+
docsUrl: 'https://nodejs.org/',
30+
},
31+
],
32+
runner: {
33+
command: 'node',
34+
args: ['-v'],
35+
outputFile: 'output.json',
36+
},
37+
groups: [],
38+
slug: 'node',
39+
title: 'Node.js',
40+
icon: 'javascript',
41+
},
42+
],
43+
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
export default {
2+
upload: {
3+
organization: 'code-pushup',
4+
project: 'cli-ts',
5+
apiKey: 'e2e-api-key',
6+
server: 'https://e2e.com/api',
7+
},
8+
categories: [
9+
{
10+
slug: 'category-1',
11+
title: 'Category 1',
12+
refs: [
13+
{
14+
type: 'audit',
15+
plugin: 'node',
16+
slug: 'node-version',
17+
weight: 1,
18+
},
19+
],
20+
},
21+
],
22+
plugins: [
23+
{
24+
audits: [
25+
{
26+
slug: 'node-version',
27+
title: 'Node version',
28+
description: 'prints node version to file',
29+
docsUrl: 'https://nodejs.org/',
30+
},
31+
],
32+
runner: {
33+
command: 'node',
34+
args: ['-v'],
35+
outputFile: 'output.json',
36+
},
37+
groups: [],
38+
slug: 'node',
39+
title: 'Node.js',
40+
icon: 'javascript',
41+
},
42+
],
43+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// the point is to test runtime import which requires tsconfig for path aliases
2+
import customPlugin from '@example/custom-plugin';
3+
4+
const config = {
5+
plugins: [customPlugin],
6+
};
7+
8+
export default config;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const customPluginConfig = {
2+
slug: 'good-feels',
3+
title: 'Good feels',
4+
icon: 'javascript',
5+
audits: [
6+
{
7+
slug: 'always-perfect',
8+
title: 'Always perfect',
9+
},
10+
],
11+
runner: () => [
12+
{
13+
slug: 'always-perfect',
14+
score: 1,
15+
value: 100,
16+
displayValue: '✅ Perfect! 👌',
17+
},
18+
],
19+
};
20+
21+
export function customPlugin() {
22+
return customPluginConfig;
23+
}
24+
export default customPluginConfig;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"allowImportingTsExtensions": true,
5+
"moduleResolution": "node",
6+
"paths": {
7+
"@example/custom-plugin": ["./custom-plugin.ts"]
8+
}
9+
},
10+
"include": ["*.ts"]
11+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
export default {
2+
upload: {
3+
organization: 'code-pushup',
4+
project: 'cli-js',
5+
apiKey: 'e2e-api-key',
6+
server: 'https://e2e.com/api',
7+
},
8+
categories: [
9+
{
10+
slug: 'category-1',
11+
title: 'Category 1',
12+
refs: [
13+
{
14+
type: 'audit',
15+
plugin: 'node',
16+
slug: 'node-version',
17+
weight: 1,
18+
},
19+
],
20+
},
21+
],
22+
plugins: [
23+
{
24+
audits: [
25+
{
26+
slug: 'node-version',
27+
title: 'Node version',
28+
description: 'prints node version to file',
29+
docsUrl: 'https://nodejs.org/',
30+
},
31+
],
32+
runner: {
33+
command: 'node',
34+
args: ['-v'],
35+
outputFile: 'output.json',
36+
},
37+
groups: [],
38+
slug: 'node',
39+
title: 'Node.js',
40+
icon: 'javascript',
41+
},
42+
],
43+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import type { CoreConfig } from '@code-pushup/models';
2+
3+
export default {
4+
persist: { outputDir: 'tmp' },
5+
upload: {
6+
organization: 'code-pushup',
7+
project: 'cli-ts',
8+
apiKey: 'e2e-api-key',
9+
server: 'https://e2e.com/api',
10+
},
11+
categories: [
12+
{
13+
slug: 'bug-prevention',
14+
title: 'Bug prevention',
15+
// due to duplicate category references, the config is invalid
16+
refs: [
17+
{
18+
type: 'audit',
19+
plugin: 'node',
20+
slug: 'node-version',
21+
weight: 1,
22+
},
23+
{
24+
type: 'audit',
25+
plugin: 'node',
26+
slug: 'node-version',
27+
weight: 1,
28+
},
29+
],
30+
},
31+
],
32+
plugins: [
33+
{
34+
audits: [
35+
{
36+
slug: 'node-version',
37+
title: 'Node version',
38+
description: 'prints node version to file',
39+
docsUrl: 'https://nodejs.org/',
40+
},
41+
],
42+
runner: {
43+
command: 'node',
44+
args: ['-v'],
45+
outputFile: 'output.json',
46+
},
47+
groups: [],
48+
slug: 'node',
49+
title: 'Node.js',
50+
icon: 'javascript',
51+
},
52+
],
53+
} satisfies CoreConfig;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// the point is to test runtime import which relies on alias defined in tsconfig.json "paths"
2+
// non-type import from '@example/custom-plugin' wouldn't work without --tsconfig
3+
// eslint-disable-next-line import/no-unresolved
4+
import customPlugin from '@example/custom-plugin';
5+
6+
const config = {
7+
plugins: [customPlugin],
8+
};
9+
10+
export default config;

0 commit comments

Comments
 (0)