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

Run tests on windows #1111

Merged
merged 26 commits into from
Sep 16, 2024
Merged

Run tests on windows #1111

merged 26 commits into from
Sep 16, 2024

Conversation

baev
Copy link
Member

@baev baev commented Aug 12, 2024

Context

Checklist

@baev baev force-pushed the run-tests-windows branch from 1cbcaca to 8d3412e Compare August 15, 2024 10:44
@github-actions github-actions bot added theme:api Javascript API related issue theme:cucumberjs CucumberJS related issue labels Aug 15, 2024
@baev baev force-pushed the run-tests-windows branch from 13977df to 55027f0 Compare August 16, 2024 12:44
@github-actions github-actions bot added the theme:jasmine Jasmine related issue label Aug 19, 2024
@baev baev force-pushed the run-tests-windows branch from c2f6d71 to be0204c Compare August 19, 2024 13:01
@github-actions github-actions bot added the theme:jest Jest related issue label Aug 19, 2024
@baev baev force-pushed the run-tests-windows branch from beddaa8 to 0974fec Compare August 27, 2024 12:16
@github-actions github-actions bot added the theme:mocha Mocha related issue label Aug 27, 2024
@baev baev force-pushed the run-tests-windows branch from 0974fec to c6cf131 Compare August 27, 2024 12:56
baev and others added 11 commits September 10, 2024 17:33
Interpolated values contain back-slashes on Windows, which make the
string literals in vitest.config.ts invalid.
Case-sensitivity varies across OS. On Linux/Mac, env var names that
differs in case only refer to different variables. On Windows it's
the opposite: such variabled refer to the same variable.
@delatrie
Copy link
Collaborator

delatrie commented Sep 16, 2024

Running tests on Windows

The PR fixes test utilities of all packages to be runnable on Windows. New CI jobs will build & test packages on Windows in all future PRs.

Typescript configuration files for testing

Previously, test files were covered by tsconfig.test.json files in the root of each package. That didn't play well with some IDEs because, when analyzing a file, they expect tsconfig.json to be present in the file directory or its parent. In this PR I've put those config files in the test directories and renamed them to tsconfig.json. Vitest and ESlint configs have been adjusted.

Casing of environment labels

Given the following two environment variables:

  • ALLURE_LABEL_foo=bar
  • ALLURE_LABEL_FOO=baz

When we give them to a process, it receives either two distinct variables (Linux, Mac) or just one (Windows).
Since the behavior differs across OS, I've removed the corresponding checks from the environment variable tests.

OS- and CWD-consistency of test results

All packages now calculate fullName, package, testCaseId, and historyId in a way that doesn't depend on OS and CWD:

  • On Windows, paths are converted to POSIX-paths (\ chars are replaced with /).
  • Relative paths are resolved against the project root (the nearest directory, starting from the CWD, that contains package.json). That allows getting consistent results when running tests from project subdirectories. If there is no project root, the CWD is used as a fallback.

The list of packages, fixed by this PR:

  • allure-cucumberjs
  • allure-cypress
  • allure-jasmine
  • allure-jest
  • allure-mocha
  • allure-playwright
  • allure-vitest

Allure-codeceptjs uses allure-mocha under the hood, which means it automatically inherits those behaviors.

Newman-reporter-allure doesn't use FS paths, so it doesn't need to be fixed.

Allure-mocha testCaseId collision

Allure-mocha mistakenly doesn't use the test file path when calculating testCaseId of a test. This PR fixes that.

@delatrie delatrie requested a review from epszaw September 16, 2024 10:07
@baev baev merged commit 5ee7a1e into main Sep 16, 2024
12 checks passed
@baev baev deleted the run-tests-windows branch September 16, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fullName and testCaseId calculations are inconsistent between OS and CWD
3 participants