Skip to content

Commit

Permalink
refactor: tests/integration/didyoumean.test.cjs (#5912)
Browse files Browse the repository at this point in the history
* refactor: file reorganization for  didyoumean test

- rename test file
- move snapshot files to new destination

* refactor: convert file to ESM

* refactor: replace ava with vitest

- replace ava with vitest
- adjust tests accordingly
- update snapshots

* style: apply lint rules

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
hereje and kodiakhq[bot] authored Aug 2, 2023
1 parent 0fc2bad commit 07d3111
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`suggests closest matching command on typo 1`] = `
"› Warning: sta is not a netlify command.
? Did you mean api (y/N) "
`;

exports[`suggests closest matching command on typo 2`] = `
"› Warning: opeen is not a netlify command.
? Did you mean open (y/N) "
`;

exports[`suggests closest matching command on typo 3`] = `
"› Warning: hel is not a netlify command.
? Did you mean dev (y/N) "
`;

exports[`suggests closest matching command on typo 4`] = `
"› Warning: versio is not a netlify command.
? Did you mean serve (y/N) "
`;
13 changes: 13 additions & 0 deletions tests/integration/commands/didyoumean/didyoumean.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test } from 'vitest'

import callCli from '../../utils/call-cli.cjs'
import { normalize } from '../../utils/snapshots.cjs'

test('suggests closest matching command on typo', async (t) => {
// failures are expected since we effectively quit out of the prompts
const errors = await Promise.allSettled([callCli(['sta']), callCli(['opeen']), callCli(['hel']), callCli(['versio'])])
errors.forEach((error) => {
t.expect(error.status).toEqual('rejected')
t.expect(normalize(error.reason.stdout, { duration: true, filePath: true })).toMatchSnapshot()
})
})
17 changes: 0 additions & 17 deletions tests/integration/didyoumean.test.cjs

This file was deleted.

27 changes: 0 additions & 27 deletions tests/integration/snapshots/didyoumean.test.cjs.md

This file was deleted.

Binary file removed tests/integration/snapshots/didyoumean.test.cjs.snap
Binary file not shown.

1 comment on commit 07d3111

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,303
  • Package size: 271 MB

Please sign in to comment.