Skip to content

Commit 975a6cf

Browse files
committed
testing
1 parent b437d72 commit 975a6cf

File tree

9 files changed

+110
-27
lines changed

9 files changed

+110
-27
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [22.x, 24.x]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: 10.17.1
32+
33+
- name: Get pnpm store directory
34+
shell: bash
35+
run: |
36+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
37+
38+
- name: Setup pnpm cache
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ env.STORE_PATH }}
42+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-pnpm-store-
45+
46+
- name: Install dependencies
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Build packages
50+
run: pnpm -r run build
51+
52+
- name: Run tests
53+
run: pnpm -r run test
54+
55+
- name: Run linter
56+
run: pnpm -r run lint

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ package-lock.json
1313

1414

1515
.claude/settings.local.json
16+
.envrc

packages/b2c-cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"postpack": "shx rm -f oclif.manifest.json",
7272
"posttest": "pnpm run lint",
7373
"prepack": "oclif manifest && oclif readme",
74-
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
74+
"pretest": "tsc --noEmit && tsc --noEmit -p test",
75+
"test": "OCLIF_TEST_ROOT=. mocha --forbid-only \"test/**/*.test.ts\"",
7576
"version": "oclif readme && git add README.md"
7677
},
7778
"types": "dist/index.d.ts"

packages/b2c-cli/test/commands/hello/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {expect} from 'chai'
33

44
describe('hello', () => {
55
it('runs hello', async () => {
6-
const {stdout} = await runCommand('hello friend --from oclif')
7-
expect(stdout).to.contain('hello friend from oclif!')
6+
const {stdout} = await runCommand('hello bob --from jane')
7+
expect(stdout).to.contain('hello bob from jane!')
88
})
99
})

packages/b2c-cli/test/commands/hello/world.test.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"extends": "../tsconfig",
2+
"extends": "../tsconfig.json",
33
"compilerOptions": {
4-
"noEmit": true
4+
"noEmit": true,
5+
"rootDir": ".",
6+
"types": ["node", "mocha", "chai"]
57
},
6-
"references": [
7-
{"path": ".."}
8-
]
8+
"include": ["./**/*"]
99
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {includeIgnoreFile} from '@eslint/compat'
2+
import prettier from 'eslint-config-prettier'
3+
import tseslint from 'typescript-eslint'
4+
import path from 'node:path'
5+
import {fileURLToPath} from 'node:url'
6+
7+
const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')
8+
9+
export default [
10+
includeIgnoreFile(gitignorePath),
11+
...tseslint.configs.recommended,
12+
prettier,
13+
{
14+
files: ['**/*.ts'],
15+
languageOptions: {
16+
parserOptions: {
17+
project: true,
18+
tsconfigRootDir: import.meta.dirname,
19+
},
20+
},
21+
},
22+
]

packages/b2c-tooling/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@
3535
"build:esm": "tsc -p tsconfig.esm.json",
3636
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
3737
"clean": "shx rm -rf dist",
38-
"lint": "eslint src --ext .ts",
38+
"lint": "eslint",
3939
"test": "echo \"Error: no test specified\" && exit 0"
4040
},
4141
"devDependencies": {
42+
"@eslint/compat": "^1",
4243
"@types/node": "^18",
4344
"eslint": "^9",
45+
"eslint-config-prettier": "^10",
4446
"shx": "^0.3.3",
45-
"typescript": "^5"
47+
"typescript": "^5",
48+
"typescript-eslint": "^8"
4649
},
4750
"engines": {
4851
"node": ">=18.0.0"

pnpm-lock.yaml

Lines changed: 17 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)