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: no error when env is missing #851

Open
cyrus-za opened this issue Sep 12, 2023 · 0 comments
Open

bug: no error when env is missing #851

cyrus-za opened this issue Sep 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@cyrus-za
Copy link

Node.js version

18.16.0

NPM version

pnpm 8.7.4

@checkly/cli version

checkly 4.1.0

Steps to reproduce

Run npm create checkly

Using the defaults, create a check in checks and let it point to a spec file of any basic playwright test

create a lib/env.ts file with the following content

const { BASE_URL } = process.env

if(!BASE_URL) throw new Error("BASE_URL is a required env")

Create .env file with BASE_URL=https://github.com

edit your .spec file to import BASE_URL

import { BASE_URL } from './lib/env'

test.describe("my test suite", () => {
    test("my test", async ({ page }) => {
      await page.goTo(BASE_URL)
      await expect(page).toHaveTitle(/Github/)
  })
})

Run the check with npx checkly test --env-file .env --record
Your test should pass without issues

Run npx checkly deploy -f

What is expected?

Your check should run on schedule and succeed

What is actually happening?

Your check now runs on schedule but it immediately fails.
Logs show no error message other than "No tests found"

image

If you try to edit the test and run it manually within checkly dashboard you also get no logs at all.

Any additional comments?

After spending a few hours debugging, I realised it was because when I do npx checkly deploy it does not use the .env file (duh!) and I had to manually add the env in the checkly dashboard

It would be really helpful if the error is actually logged

@cyrus-za cyrus-za added the bug Something isn't working label Sep 12, 2023
@checkly checkly deleted a comment from modern-sapien Dec 21, 2023
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

1 participant