Skip to content

Commit 18e5254

Browse files
committed
Run unit tests on Windows
This patch supersedes and closes #1291 [1]. [1] #1291
1 parent b33c26f commit 18e5254

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ jobs:
8989
run: npm install --engine-strict
9090
- name: Build
9191
run: npm run build
92-
- name: Test
92+
- name: Test (unit)
93+
run: npm run test:unit
94+
- name: Test (integration)
9395
run: npm run test:integration
9496
- name: Versions
9597
run: |

lib/helpers/posix.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import path from "node:path";
2+
3+
export const toPosix = (location: string) =>
4+
path.sep === "\\" ? location.replaceAll("\\", "/") : location;

lib/step-definitions.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import assert from "node:assert/strict";
22
import util from "node:util";
33

4+
import { toPosix } from "./helpers/posix";
45
import {
56
combineIntoConfiguration,
67
ICypressRuntimeConfiguration,
@@ -56,7 +57,7 @@ function example(
5657
}
5758

5859
for (let i = 0; i < expected.length; i++) {
59-
if (expected[i] !== actual[i]) {
60+
if (expected[i] !== toPosix(actual[i])) {
6061
throwUnequal();
6162
}
6263
}
@@ -70,7 +71,7 @@ describe("pathParts()", () => {
7071
it(`should return ${util.inspect(expectedParts)} for ${util.inspect(
7172
relativePath,
7273
)}`, () => {
73-
assert.deepEqual(pathParts(relativePath), expectedParts);
74+
assert.deepEqual(pathParts(relativePath).map(toPosix), expectedParts);
7475
});
7576
});
7677

lib/subpath-entrypoints/esbuild.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import type esbuild from "esbuild";
55

66
import { ensure } from "../helpers/assertions";
77
import { default as origDebug } from "../helpers/debug";
8+
import { toPosix } from "../helpers/posix";
89
import { compile } from "../template";
910

1011
const debug = origDebug.extend("esbuild");
1112

12-
const toPosix = (location: string) =>
13-
path.sep === "\\" ? location.replaceAll("\\", "/") : location;
14-
1513
export function createEsbuildPlugin(
1614
configuration: Cypress.PluginConfigOptions,
1715
options: { prettySourceMap: boolean } = { prettySourceMap: false },

0 commit comments

Comments
 (0)