Skip to content

Commit

Permalink
Chore(dev-deps): Vitest 3 (#1654)
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias authored Jan 20, 2025
1 parent 3232b50 commit 1be9de1
Show file tree
Hide file tree
Showing 72 changed files with 369 additions and 337 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
"@repo/hoist-peer-dependencies": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@types/node": "^22.10.5",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"@vitest/coverage-v8": "^3.0.2",
"@vitest/ui": "^3.0.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-n": "^17.15.1",
Expand All @@ -93,7 +93,7 @@
"turbo": "^2.3.3",
"typescript": "^5.7.3",
"typescript-eslint": "^8.19.1",
"vitest": "^2.1.8"
"vitest": "^3.0.2"
},
"packageManager": "yarn@4.5.3+sha512.3003a14012e2987072d244c720506549c1aab73ee728208f1b2580a9fd67b92d61ba6b08fe93f6dce68fd771e3af1e59a0afa28dd242dd0940d73b95fedd4e90",
"engines": {
Expand Down
17 changes: 10 additions & 7 deletions packages/inquirer/inquirer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import inquirer from './src/index.js';
import type { QuestionMap, Answers, Question, DistinctQuestion } from './src/index.js';
import { _ } from './src/ui/prompt.js';

const actualCreateInterface = readline.createInterface;

declare module './src/index.js' {
interface QuestionMap {
stub: { answer?: string | boolean; message: string; default?: string };
Expand Down Expand Up @@ -78,6 +80,8 @@ beforeEach(() => {
inquirer.restoreDefaultPrompts();
inquirer.registerPrompt('stub', StubPrompt);
inquirer.registerPrompt('failing', StubFailingPrompt);

vi.resetAllMocks();
});

describe('exported types', () => {
Expand Down Expand Up @@ -264,7 +268,6 @@ describe('inquirer.prompt(...)', () => {
});

it('should close readline instance on rejected promise', async () => {
const actualCreateInterface = readline.createInterface;
vi.spyOn(readline, 'createInterface').mockImplementation((opts) => {
const rl = actualCreateInterface(opts);
vi.spyOn(rl, 'close');
Expand All @@ -280,12 +283,12 @@ describe('inquirer.prompt(...)', () => {
},
]);

await promise.catch(() => {
const rl = vi.mocked(readline.createInterface).mock.results[0]!
.value as InquirerReadline;
expect(rl.close).toHaveBeenCalledTimes(1);
expect(rl.output.end).toHaveBeenCalledTimes(1);
});
await expect(promise).rejects.toThrow();

const rl = vi.mocked(readline.createInterface).mock.results[0]!
.value as InquirerReadline;
expect(rl.close).toHaveBeenCalledTimes(1);
expect(rl.output.end).toHaveBeenCalledTimes(1);
});

it('should take a prompts array with nested names', async () => {
Expand Down
Loading

0 comments on commit 1be9de1

Please sign in to comment.