Skip to content

Commit 0db45f0

Browse files
committed
feat(infra): remove cli-tests DOCSTOOLS-4734
1 parent 7f9a050 commit 0db45f0

21 files changed

Lines changed: 46 additions & 3498 deletions

.eslintignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ node_modules
99
.env
1010
.DS_Store
1111
.eslintrc.js
12-
vitest.config.mjs
12+
vitest.units.config.ts
13+
vitest.integration.config.ts
1314
/dist
1415
/cache
1516
/coverage
1617
/external
1718
/scripts
1819
/tests/mocks
19-
/tests/bin.mjs
2020

2121
.lintstagedrc.js
2222
.prettierrc.js

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ jobs:
3535
run: npm run build
3636

3737
- name: Run e2e tests
38-
working-directory: tests
39-
run: npm ci && npm test
38+
run: npm run e2e

.github/workflows/release.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,6 @@ jobs:
105105
env:
106106
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
107107

108-
- name: Publish stable tests to npm
109-
working-directory: tests
110-
if: (github.event_name == 'release' && github.event.release.draft == false) || (github.event_name == 'workflow_dispatch' && inputs.release_type == 'stable')
111-
run: |
112-
npm version ${{steps.package.outputs.version}}
113-
npm ci
114-
npm publish --provenance --access public
115-
env:
116-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
117-
118108
# === PRERELEASE STEPS ===
119109
- name: Set prerelease version
120110
if: github.event_name == 'workflow_dispatch' && inputs.release_type == 'prerelease'
@@ -126,20 +116,6 @@ jobs:
126116
env:
127117
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
128118

129-
- name: Set prerelease version for tests
130-
working-directory: tests
131-
if: github.event_name == 'workflow_dispatch' && inputs.release_type == 'prerelease'
132-
run: |
133-
npm ci
134-
npm version --no-git-tag-version 0.0.0-rc-$(git branch --show-current)-${{github.run_id}}
135-
136-
- name: Publish prerelease tests to npm
137-
working-directory: tests
138-
if: github.event_name == 'workflow_dispatch' && inputs.release_type == 'prerelease'
139-
run: npm publish --tag $(git branch --show-current) --provenance --access public
140-
env:
141-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
142-
143119
# === DEPRECATE STEPS ===
144120
- name: Validate deprecate inputs
145121
if: github.event_name == 'workflow_dispatch' && inputs.release_type == 'deprecate'

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
.env
55
.DS_Store
66
.eslintrc.js
7-
vitest.config.mjs
7+
vitest.units.config.ts
8+
vitest.integration.config.ts
89
node_modules
910
/lib
1011
/dist
@@ -13,4 +14,3 @@ node_modules
1314
/coverage
1415
/external
1516
/tests/mocks
16-
/tests/bin.mjs

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"./manifest": "./build/manifest.json",
3535
"./mdit-plugins": "./build/mdit-plugins.js",
3636
"./arcadia-vcs": "./build/arcadia-vcs.js",
37-
"./github-vcs": "./build/github-vcs.js"
37+
"./github-vcs": "./build/github-vcs.js",
38+
"./tests/fixtures": "./tests/fixtures/index.ts"
3839
},
3940
"main": "build/index.js",
4041
"bin": {
@@ -45,18 +46,20 @@
4546
"lib",
4647
"build",
4748
"assets",
48-
"schemas"
49+
"schemas",
50+
"tests",
51+
"vitest.integration.config.ts"
4952
],
5053
"scripts": {
5154
"build": "npm run build:clean && node scripts/build.cli.js",
5255
"build:types": "tspc -p tsconfig.lib.json || true; tspc -p tsconfig.build.json || true",
5356
"build:clean": "rm -rf build lib",
54-
"e2e": "npm run build && cd tests && npm test",
57+
"e2e": "npm run build && vitest run -c vitest.integration.config.ts",
5558
"prepublishOnly": "npm run lint && npm run build && npm run build:types",
5659
"start": "node build/index.js",
57-
"test": "vitest run",
58-
"test:coverage": "vitest run --coverage",
59-
"test:watch": "vitest",
60+
"test": "vitest run -c vitest.units.config.ts",
61+
"test:coverage": "vitest run -c vitest.units.config.ts --coverage",
62+
"test:watch": "vitest -c vitest.units.config.ts",
6063
"typecheck": "tsc --noEmit",
6164
"regenerate-schemas": "scripts/regenerate-schemas.js",
6265
"lint": "lint",
@@ -137,6 +140,7 @@
137140
"esbuild": "^0.27.2",
138141
"html-escaper": "^3.0.3",
139142
"husky": "8.0.3",
143+
"markdown-it-attrs": "^4.1.0",
140144
"mime-types": "2.1.35",
141145
"minimatch": "9.0.3",
142146
"node-html-parser": "6.1.5",

tests/bin.mjs

Lines changed: 0 additions & 53 deletions
This file was deleted.

tests/e2e/errors.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Report} from '../fixtures/runners/types';
1+
import type {Report} from '../fixtures/runner';
22

33
import {describe, expect, it} from 'vitest';
44

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import type {Runner} from './runners';
2-
3-
import {createRunner} from './runners';
4-
import {cleanupDirectory} from './utils/file';
1+
import runner from './runner';
2+
import {cleanupDirectory} from './file';
53

64
export interface BuildRunArgs {
75
md2md?: boolean;
@@ -18,41 +16,27 @@ export interface TranslateRunArgs {
1816
}
1917

2018
class Build {
21-
private readonly runner: Runner;
22-
23-
constructor(runner: Runner) {
24-
this.runner = runner;
25-
}
26-
2719
run(input: string, output: string, args: string[], env?: Record<string, string>) {
28-
return this.runner.runYfmDocs(
20+
return runner.runYfmDocs(
2921
['--input', input, '--output', output, '--quiet', '--allowHtml', ...args],
3022
env,
3123
);
3224
}
3325
}
3426

3527
class Extract {
36-
private readonly runner: Runner;
37-
38-
constructor(runner: Runner) {
39-
this.runner = runner;
40-
}
41-
4228
run(input: string, output: string, args: string[], env?: Record<string, string>) {
43-
return this.runner.runYfmDocs(
29+
return runner.runYfmDocs(
4430
['translate', 'extract', '--input', input, '--output', output, '--quiet', ...args],
4531
env,
4632
);
4733
}
4834
}
4935

5036
export class CliTestAdapter {
51-
readonly runner: Runner = createRunner();
52-
53-
readonly build = new Build(this.runner);
37+
readonly build = new Build();
5438

55-
readonly extract = new Extract(this.runner);
39+
readonly extract = new Extract();
5640

5741
async testBuildPass(
5842
inputPath: string,
@@ -110,7 +94,7 @@ export class CliTestAdapter {
11094
...additionalArgs.split(' ').filter(Boolean),
11195
];
11296

113-
await this.runner.runYfmDocs(baseArgs);
97+
await runner.runYfmDocs(baseArgs);
11498
}
11599
}
116100

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import type {BuildRunArgs} from '../cliAdapter';
1+
import type {BuildRunArgs} from './cli';
22

33
import {readFileSync} from 'node:fs';
44
import {rm} from 'node:fs/promises';
55
import {join, resolve} from 'node:path';
66
import {glob} from 'glob';
77
import {expect, test} from 'vitest';
88

9-
import {TestAdapter} from '../cliAdapter';
10-
9+
import {TestAdapter} from './cli';
1110
import {bundleless, hashless, platformless} from './test';
1211

1312
const SYSTEM_DIRS = ['_bundle/', '_search/'];
@@ -124,8 +123,8 @@ type TestPaths = {
124123

125124
export function getTestPaths(testRootPath: string): TestPaths {
126125
return {
127-
inputPath: resolve(__dirname, '../../', join(testRootPath, 'input')),
128-
outputPath: resolve(__dirname, '../../', join(testRootPath, 'output')),
126+
inputPath: resolve(__dirname, '../', join(testRootPath, 'input')),
127+
outputPath: resolve(__dirname, '../', join(testRootPath, 'output')),
129128
};
130129
}
131130

tests/fixtures/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
export * from './cliAdapter';
2-
export * from './utils/file';
3-
export * from './utils/test';
1+
export * from './cli';
2+
export * from './file';
3+
export * from './test';
4+
export * from './runner';

0 commit comments

Comments
 (0)