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

bug: The following dependencies weren't found #888

Open
kirkstrobeck opened this issue Nov 12, 2023 · 6 comments
Open

bug: The following dependencies weren't found #888

kirkstrobeck opened this issue Nov 12, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@kirkstrobeck
Copy link

Node.js version

v18.12.1

NPM version

8.19.2

@checkly/cli version

4.2.0

Steps to reproduce

Import a tsx file

What is expected?

Handle the tsx file or say that tsx is invalid

What is actually happening?

npx checkly test -e ENVIRONMENT_URL=https://[url]
 ›   Warning: checkly update available from 4.2.0 to 4.4.0.
Parsing your project... !
    Error: Encountered an error parsing check files for /Users/[path]/tests/test.spec.ts.

    The following dependencies weren't found:
    	/Users/[path]/src/components/[tsx-filename]

Any additional comments?

No response

@kirkstrobeck kirkstrobeck added the bug Something isn't working label Nov 12, 2023
@tnolet
Copy link
Member

tnolet commented Nov 20, 2023

Hey @kirkstrobeck thanks for reporting.

  1. Why are you importing a tsx file into your checkly CLI config? Just want to know your use case.
  2. Can you share some example code?

@kirkstrobeck
Copy link
Author

I had a test, foo.spec.ts and it was importing a file, shared.tsx, that had a value I wanted to assert in an expect.

Examples

// shared.tsx
const base = {
  greeting: <>Hey there<br />Bob</>,
  greetingButtonText: 'Hey there',
};

export default base;
// foo.spec.ts
import { test } from '@playwright/test';
import base from './shared';

test('button text matches shared.tsx greetingButtonText', async ({ page }) => {
  // Navigate to the page where the button is located
  await page.goto('YOUR_PAGE_URL');

  // Locate the button by a selector (update the selector as per your HTML structure)
  const buttonText = await page.textContent('SELECTOR_FOR_YOUR_BUTTON');

  // Assert that the text of the button matches greetingButtonText from shared.tsx
  test.expect(buttonText).toBe(base.greetingButtonText);
});

@tnolet
Copy link
Member

tnolet commented Nov 21, 2023

@kirkstrobeck I see! As it's just a text based dependency, not some NPM package or large binary file, I think that would be possible.

@tnolet
Copy link
Member

tnolet commented Nov 21, 2023

@kirkstrobeck do you expect the .tsx file to be compiled? As that would be more of an edge case to support.

@tnolet
Copy link
Member

tnolet commented Dec 21, 2023

@kirkstrobeck just bumping this question. Importing .tsx is not something we can directly support as it requires a extra parsing. Shall we turn this into a feature request?

@kirkstrobeck
Copy link
Author

I would expect it to warn properly. Something like “You’re trying to import a .tsx file, which is not supported.” Should also handle any other unexpected file extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants