Skip to content

Commit

Permalink
fix: update test case & bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyingchun committed Jul 27, 2024
1 parent f5f3e08 commit a1bb963
Show file tree
Hide file tree
Showing 16 changed files with 1,365 additions and 1,139 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-laws-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperse/install-local": patch
---

update test case & bump version
4 changes: 4 additions & 0 deletions .github/workflows/ci-integrity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ jobs:
run: |
yarn lint
- name: Typecheck
run: |
yarn typecheck
- name: Unit tests
run: |
yarn test
Expand Down
6 changes: 2 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
"recommendations": ["dbaeumer.vscode-eslint"]
}
13 changes: 4 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@
"request": "launch",
"name": "Debug Test File",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"test-unit"
],
"runtimeArgs": ["run-script", "test-unit"],
"skipFiles": [
"<node_internals>/**",
"<node_internals>/**"
// "**/node_modules/**"
],
"args": [
"${relativeFile}"
],
"args": ["${relativeFile}"],
"env": {}
}
]
}
}
10 changes: 6 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.experimental.useFlatConfig": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
"[json]": {
"editor.formatOnSave": false
},
}
"[jsonc]": {
"editor.formatOnSave": false
}
}
434 changes: 217 additions & 217 deletions .yarn/releases/yarn-4.3.0.cjs → .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.0.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,36 @@
}
},
"dependencies": {
"@hyperse/exec-program": "^1.0.6",
"@hyperse/exec-program": "^1.0.10",
"lodash.flatmap": "^4.5.0",
"rimraf": "^5.0.7",
"rimraf": "^6.0.1",
"uniqid": "^5.4.0"
},
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.5",
"@changesets/cli": "2.27.7",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@hyperse/eslint-config-hyperse": "^1.0.8",
"@hyperse/eslint-config-hyperse": "^1.0.10",
"@types/lodash.flatmap": "^4.5.9",
"@types/node": "^20.14.2",
"@types/node": "^20.14.12",
"@types/uniqid": "^5.3.4",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "^9.4.0",
"husky": "9.0.11",
"eslint": "^9.8.0",
"husky": "9.1.3",
"lint-staged": "15.2.7",
"npm-run-all": "^4.1.5",
"tsup": "^8.1.0",
"typescript": "^5.4.5",
"vite": "^5.2.13",
"vitest": "^1.6.0"
"tsup": "^8.2.3",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vitest": "^2.0.4"
},
"engines": {
"node": ">=20"
},
"publishConfig": {
"access": "public"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].1"
}
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import os from 'os';
import path from 'path';
import { rimraf } from 'rimraf';
import uniqid from 'uniqid';
import { exec, type ExecOptions } from '@hyperse/exec-program';
import { type ExecOptions, execute } from '@hyperse/exec-program';

export function del(filename: string) {
return rimraf(filename);
Expand All @@ -21,5 +21,5 @@ export function execa<T extends ExecOptions>(
args?: readonly string[] | undefined,
options?: T | undefined
) {
return exec(file, args, options);
return execute(file, args, options);
}
66 changes: 33 additions & 33 deletions tests/core/progress.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,36 +102,36 @@ const createPackage = (name: string) => ({
packageJson: { name, version: '0' },
});

const stubStdOut = (): WriteStream => ({
columns: 1000,
// @ts-expect-error
cursorTo: vi.fn(),
clearLine: vi.fn(),
eventNames: vi.fn(),
prependOnceListener: vi.fn(),
prependListener: vi.fn(),
listenerCount: vi.fn(),
emit: vi.fn(),
listeners: vi.fn(),
getMaxListeners: vi.fn(),
setMaxListeners: vi.fn(),
removeAllListeners: vi.fn(),
removeListener: vi.fn(),
once: vi.fn(),
on: vi.fn(),
addListener: vi.fn(),
isTTY: true,
readable: false,
writable: true,
write: vi.fn<any>(),
end: vi.fn<any>(),
read: vi.fn(),
setEncoding: vi.fn(),
pause: vi.fn(),
resume: vi.fn(),
isPaused: vi.fn(),
pipe: vi.fn(),
unpipe: vi.fn(),
unshift: vi.fn(),
wrap: vi.fn(),
});
const stubStdOut = (): WriteStream =>
({
columns: 1000,
cursorTo: vi.fn(),
clearLine: vi.fn(),
eventNames: vi.fn(),
prependOnceListener: vi.fn(),
prependListener: vi.fn(),
listenerCount: vi.fn(),
emit: vi.fn(),
listeners: vi.fn(),
getMaxListeners: vi.fn(),
setMaxListeners: vi.fn(),
removeAllListeners: vi.fn(),
removeListener: vi.fn(),
once: vi.fn(),
on: vi.fn(),
addListener: vi.fn(),
isTTY: true,
readable: false,
writable: true,
write: vi.fn<any>(),
end: vi.fn<any>(),
read: vi.fn(),
setEncoding: vi.fn(),
pause: vi.fn(),
resume: vi.fn(),
isPaused: vi.fn(),
pipe: vi.fn(),
unpipe: vi.fn(),
unshift: vi.fn(),
wrap: vi.fn(),
}) as any;
2 changes: 1 addition & 1 deletion tests/core/save.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Options } from '../../src/Options.js';
import { saveIfNeeded } from '../../src/save.js';

describe('saveIfNeeded', () => {
let writeFileStub: MockInstance<any, Promise<void>>;
let writeFileStub: MockInstance<() => Promise<void>>;

let input: InstallTarget[];

Expand Down
9 changes: 6 additions & 3 deletions tests/core/siblingInstall.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import * as progressModule from '../../src/progress.js';
import { siblingInstall } from '../../src/siblingInstall.js';

describe('siblingInstall', () => {
let readdirStub: MockInstance<any, Promise<string[]>>;
let readPackageJson: MockInstance<[string], Promise<PackageJson>>;
let localInstallerStub: { install: Mock<any, InstallTarget[]>; on: Mock };
let readdirStub: MockInstance<() => Promise<string[]>>;
let readPackageJson: MockInstance<(from: string) => Promise<PackageJson>>;
let localInstallerStub: {
install: Mock<() => Promise<InstallTarget[]>>;
on: Mock;
};

beforeEach(() => {
localInstallerStub = { install: vi.fn(), on: vi.fn() };
Expand Down
9 changes: 2 additions & 7 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@
"incremental": false,
"paths": {}
},
"exclude": [
"**/*.stories.tsx",
"**/*.stories.mdx",
".storybook/**",
"dist"
]
}
"exclude": ["**/*.stories.tsx", "**/*.stories.mdx", ".storybook/**", "dist"]
}
16 changes: 4 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@
"baseUrl": "./",
"rootDir": "./",
"outDir": "dist",
"types": [
"vitest/globals"
],
"types": ["vitest/globals"],
"paths": {
"@hyperse/install-local": [
"./src/index.js"
],
"@hyperse/install-local": ["./src/index.js"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
}
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
3 changes: 1 addition & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fileURLToPath } from 'url';
import { configDefaults, defineConfig } from 'vitest/config';

export default defineConfig({
Expand All @@ -7,7 +6,7 @@ export default defineConfig({
testTimeout: 100000,
exclude: [...configDefaults.exclude],
alias: {
'~/': fileURLToPath(new URL('./src/', import.meta.url)),
'@/': new URL('./src/', import.meta.url).pathname,
},
include: ['**/?(*.){test,spec}.?(c|m)[jt]s?(x)'],
},
Expand Down
Loading

0 comments on commit a1bb963

Please sign in to comment.