Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in no-conditional-tests when using array destructuring #21

Closed
EvHaus opened this issue Nov 21, 2022 · 1 comment
Closed

Crash in no-conditional-tests when using array destructuring #21

EvHaus opened this issue Nov 21, 2022 · 1 comment

Comments

@EvHaus
Copy link
Contributor

EvHaus commented Nov 21, 2022

The following code:

import {describe, expect, it} from 'vitest';
import endpoint from './index.page';
import {test} from '../../../../../utils/tests/testEndpoint';

describe('my test', () => {
	it('do something', async () => {
		const asd = await test(endpoint);
		expect(1).toBe(1);
	});
});

causes eslint-plugin-vitest to crash with:

Oops! Something went wrong! :(

ESLint: 8.28.0

TypeError: Cannot use 'in' operator to search for 'body' in undefined
Occurred while linting /home/myproject/pages/api/component/[id]/duplicate/index.test.ts:7
Rule: "vitest/no-conditional-tests"
    at checkConditionalTest (/home/myproject/node_modules/.pnpm/[email protected]_hsf322ms6xhhd4b5ne6lb74y4a/node_modules/eslint-plugin-vitest/dist/index.cjs:257:20)
    at CallExpression[callee.name=/^(it|test)$/] (/home/myproject/node_modules/.pnpm/[email protected]_hsf322ms6xhhd4b5ne6lb74y4a/node_modules/eslint-plugin-vitest/dist/index.cjs:281:9)
    at ruleErrorHandler (/home/myproject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/linter.js:1115:28)
    at /home/myproject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/myproject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/myproject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/home/myproject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/home/myproject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (/home/myproject/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23)
@veritem
Copy link
Member

veritem commented Jan 11, 2023

check the latest version, let me know if it still persists.

@veritem veritem closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants