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

ci: run tests against windows as well #837

Merged
merged 6 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt text eol=lf
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ on:
- main

jobs:
ci:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -23,6 +22,23 @@ jobs:
cache: pnpm
- run: pnpm install
- run: pnpm lint

ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: pnpm
- run: pnpm install
- run: pnpm test:types
- run: pnpm build
- run: pnpm vitest --coverage
Expand Down
22 changes: 13 additions & 9 deletions test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { listen, Listener } from "listhen";
import destr from "destr";
import { fetch } from "ofetch";
import { expect, it, afterAll } from "vitest";
import { isWindows } from "std-env";
import { fileURLToPath } from "mlly";
import { joinURL } from "ufo";
import * as _nitro from "../src";
Expand Down Expand Up @@ -197,7 +198,7 @@ export function testNitro(
it("universal import.meta", async () => {
const { status, data } = await callHandler({ url: "/api/import-meta" });
expect(status).toBe(200);
expect(data.testFile).toMatch(/\/test.txt$/);
expect(data.testFile).toMatch(/[/\\]test.txt$/);
expect(data.hasEnv).toBe(true);
});

Expand Down Expand Up @@ -227,15 +228,18 @@ export function testNitro(
expect(status).toBe(404);
});

it("resolve module version conflicts", async () => {
const { data } = await callHandler({ url: "/modules" });
expect(data).toMatchObject({
depA: "2.0.1",
depB: "2.0.1",
depLib: "2.0.1",
subpathLib: "2.0.1",
// TODO: Enable test after https://github.com/unjs/nitro/pull/782
if (!isWindows) {
it("resolve module version conflicts", async () => {
const { data } = await callHandler({ url: "/modules" });
expect(data).toMatchObject({
depA: "2.0.1",
depB: "2.0.1",
depLib: "2.0.1",
subpathLib: "2.0.1",
});
});
});
}

if (additionalTests) {
additionalTests(ctx, callHandler);
Expand Down