bug: Running Tests on Windows doesn't work
See original GitHub issueDescription
Steps:
- Clone the repository
- Run
yarn
==> Runs successfully - Run
yarn test
Received the following result (full log below)
Environment
- Windows 10 with mingw64
- Node v14.19.1
Complete Log
$ yarn test
yarn run v1.22.18
$ jest
PASS src/lib/set-semver-range.spec.ts (8.309 s)
FAIL src/bin-format/format.spec.ts (8.628 s)
● format › sorts array properties alphabetically by value
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
Received: "✓", "..\\..\\..\\..\\some\\package.json"
Number of calls: 1
24 | );
25 | expect(before).toEqual(after);
> 26 | expect(log).toHaveBeenCalledWith(
| ^
27 | expect.stringMatching(/✓/),
28 | expect.stringMatching('/some/package.json'),
29 | );
at Object.<anonymous> (src/bin-format/format.spec.ts:26:17)
● format › sorts object properties alphabetically by key
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
Received
1: "✓", "..\\..\\..\\..\\some\\package.json"
2: "✓", "..\\..\\..\\..\\some\\package.json"
Number of calls: 2
46 | );
47 | expect(before).toEqual(after);
> 48 | expect(log).toHaveBeenCalledWith(
| ^
49 | expect.stringMatching(/✓/),
50 | expect.stringMatching('/some/package.json'),
51 | );
at Object.<anonymous> (src/bin-format/format.spec.ts:48:17)
● format › sorts named properties first, then the rest alphabetically
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
Received
1: "✓", "..\\..\\..\\..\\some\\package.json"
2: "✓", "..\\..\\..\\..\\some\\package.json"
3: "✓", "..\\..\\..\\..\\some\\package.json"
Number of calls: 3
68 | );
69 | expect(before).toEqual(after);
> 70 | expect(log).toHaveBeenCalledWith(
| ^
71 | expect.stringMatching(/✓/),
72 | expect.stringMatching('/some/package.json'),
73 | );
at Object.<anonymous> (src/bin-format/format.spec.ts:70:17)
● format › uses shorthand format for "bugs"
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
Received
1: "✓", "..\\..\\..\\..\\some\\package.json"
2: "✓", "..\\..\\..\\..\\some\\package.json"
3: "✓", "..\\..\\..\\..\\some\\package.json"
Number of calls: 4
89 | );
90 | expect(before).toEqual(after);
> 91 | expect(log).toHaveBeenCalledWith(
| ^
92 | expect.stringMatching(/✓/),
93 | expect.stringMatching('/some/package.json'),
94 | );
at Object.<anonymous> (src/bin-format/format.spec.ts:91:17)
● format › uses shorthand format for "repository"
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
Received
1: "✓", "..\\..\\..\\..\\some\\package.json"
2: "✓", "..\\..\\..\\..\\some\\package.json"
3: "✓", "..\\..\\..\\..\\some\\package.json"
Number of calls: 5
112 | );
113 | expect(before).toEqual(after);
> 114 | expect(log).toHaveBeenCalledWith(
| ^
115 | expect.stringMatching(/✓/),
116 | expect.stringMatching('/some/package.json'),
117 | );
at Object.<anonymous> (src/bin-format/format.spec.ts:114:17)
● format › uses github shorthand format for "repository"
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: StringMatching /✓/, StringMatching /\/some\/package.json/
Received
1: "✓", "..\\..\\..\\..\\some\\package.json"
2: "✓", "..\\..\\..\\..\\some\\package.json"
3: "✓", "..\\..\\..\\..\\some\\package.json"
Number of calls: 6
135 | );
136 | expect(before).toEqual(after);
> 137 | expect(log).toHaveBeenCalledWith(
| ^
138 | expect.stringMatching(/✓/),
139 | expect.stringMatching('/some/package.json'),
140 | );
at Object.<anonymous> (src/bin-format/format.spec.ts:137:17)
PASS src/bin-fix-mismatches/get-expected-version/get-highest-version.spec.ts (8.733 s)
PASS src/bin-fix-mismatches/get-expected-version/get-expected-version.spec.ts
PASS src/lib/disk.spec.ts
PASS src/bin-list/list-version-groups.spec.ts
PASS src/bin-lint-semver-ranges/list-semver-group-mismatches.spec.ts
FAIL src/lib/get-input/get-input.spec.ts (11.147 s)
● getInput › wrappers › when no --source cli options are given › when yarn workspaces are defined › as an array › resolves yarn workspace packages
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
Array [
Array [
"package.json",
],
Array [
- "as-array/*/package.json",
+ "as-array\\*\\package.json",
],
]
179 | disk.readFileSync.mockReturnValue(json);
180 | getInput(disk, {});
> 181 | expect(disk.globSync.mock.calls).toEqual([
| ^
182 | ['package.json'],
183 | ['as-array/*/package.json'],
184 | ]);
at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:181:46)
● getInput › wrappers › when no --source cli options are given › when yarn workspaces are defined › as an object › resolves yarn workspace packages
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
Array [
Array [
"package.json",
],
Array [
- "as-object/*/package.json",
+ "as-object\\*\\package.json",
],
]
195 | disk.readFileSync.mockReturnValue(json);
196 | getInput(disk, {});
> 197 | expect(disk.globSync.mock.calls).toEqual([
| ^
198 | ['package.json'],
199 | ['as-object/*/package.json'],
200 | ]);
at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:197:46)
● getInput › wrappers › when no --source cli options are given › when yarn workspaces are not defined › when lerna.json is defined › resolves lerna packages
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
Array [
Array [
"package.json",
],
Array [
- "lerna/*/package.json",
+ "lerna\\*\\package.json",
],
]
217 | });
218 | getInput(disk, {});
> 219 | expect(disk.globSync.mock.calls).toEqual([
| ^
220 | ['package.json'],
221 | ['lerna/*/package.json'],
222 | ]);
at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:219:46)
● getInput › wrappers › when no --source cli options are given › when yarn workspaces are not defined › when lerna.json is not defined › when pnpm workspaces are defined › resolves pnpm packages
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
Array [
Array [
"package.json",
],
Array [
- "from-pnpm/*/package.json",
+ "from-pnpm\\*\\package.json",
],
]
234 | });
235 | getInput(disk, {});
> 236 | expect(disk.globSync.mock.calls).toEqual([
| ^
237 | ['package.json'],
238 | ['from-pnpm/*/package.json'],
239 | ]);
at Object.<anonymous> (src/lib/get-input/get-input.spec.ts:236:48)
FAIL src/bin-list/list.spec.ts
● list › when dependencies are installed with different versions › when the dependency is a package maintained in this workspace › warns ab the
workspace version
expect(received).toEqual(expected) // deep equality
- Expected - 5
+ Received + 1
- Array [
- Array [
- "✕ c 0.1.0, 0.2.0",
- ],
- ]
+ Array []
14 | const scenario = scenarios.dependentDoesNotMatchWorkspaceVersion();
15 | list(getInput(scenario.disk, scenario.config), scenario.disk);
> 16 | expect(scenario.log.mock.calls).toEqual([['✕ c 0.1.0,
0.2.0']]);
| ^
17 | expect(scenario.disk.process.exit).toHaveBeenCalledWith(1);
18 | });
19 | });
at Object.<anonymous> (src/bin-list/list.spec.ts:16:41)
● list › when dependencies are installed with different versions › replaces non-semver dependencies with valid semver dependencies
expect(received).toEqual(expected) // deep equality
- Expected - 5
+ Received + 1
- Array [
- Array [
- "✕ foo 0.2.0, 0.3.0, link:vendor/foo-0.1.0, link:vendor/foo-0.2.0",
- ],
- ]
+ Array []
22 | const scenario = scenarios.mismatchesIncludeNonSemverVersions();
23 | list(getInput(scenario.disk, scenario.config), scenario.disk);
> 24 | expect(scenario.log.mock.calls).toEqual([
| ^
25 | ['✕ foo 0.2.0, 0.3.0, link:vendor/foo-0.1.0, link:vendor/foo-0.2.0'],
26 | ]);
27 | expect(scenario.disk.process.exit).toHaveBeenCalledWith(1);
at Object.<anonymous> (src/bin-list/list.spec.ts:24:39)
● list › when dependencies are installed with different versions › removes banned/disallowed dependencies
expect(received).toEqual(expected) // deep equality
- Expected - 7
+ Received + 1
Array [
Array [
- "- foo 0.1.0",
- ],
- Array [
- StringMatching /Version Group 1/,
- ],
- Array [
- "✕ bar remove this dependency",
+ "= Version Group 1 ===============================================================",
],
]
31 | const scenario = scenarios.dependencyIsBanned();
32 | list(getInput(scenario.disk, scenario.config), scenario.disk);
> 33 | expect(scenario.log.mock.calls).toEqual([
| ^
34 | ['- foo 0.1.0'],
35 | [expect.stringMatching(/Version Group 1/)],
36 | ['✕ bar remove this dependency'],
at Object.<anonymous> (src/bin-list/list.spec.ts:33:39)
FAIL src/bin-fix-mismatches/fix-mismatches.spec.ts (11.408 s)
● fixMismatches › when dependencies are installed with different versions › when the dependency is a package maintained in this workspace › uses the workspace version
expect(received).toEqual(expected) // deep equality
- Expected - 22
+ Received + 1
- Array [
- Array [
- StringContaining "packages/a/package.json",
- "{
- \"name\": \"a\",
- \"dependencies\": {
- \"c\": \"0.0.1\"
- }
- }
- ",
- ],
- Array [
- StringContaining "packages/b/package.json",
- "{
- \"name\": \"b\",
- \"devDependencies\": {
- \"c\": \"0.0.1\"
- }
- }
- ",
- ],
- ]
+ Array []
14 | const scenario = scenarios.dependentDoesNotMatchWorkspaceVersion();
15 | fixMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
> 16 | expect(scenario.disk.writeFileSync.mock.calls).toEqual([
| ^
17 | scenario.files['packages/a/package.json'].diskWriteWhenChanged,
18 | scenario.files['packages/b/package.json'].diskWriteWhenChanged,
19 | ]);
at Object.<anonymous> (src/bin-fix-mismatches/fix-mismatches.spec.ts:16:56)
● fixMismatches › when dependencies are installed with different versions › replaces non-semver dependencies with valid semver dependencies
expect(received).toEqual(expected) // deep equality
- Expected - 32
+ Received + 1
- Array [
- Array [
- StringContaining "packages/a/package.json",
- "{
- \"name\": \"a\",
- \"dependencies\": {
- \"foo\": \"0.3.0\"
- }
- }
- ",
- ],
- Array [
- StringContaining "packages/b/package.json",
- "{
- \"name\": \"b\",
- \"dependencies\": {
- \"foo\": \"0.3.0\"
- }
- }
- ",
- ],
- Array [
- StringContaining "packages/d/package.json",
- "{
- \"name\": \"d\",
- \"dependencies\": {
- \"foo\": \"0.3.0\"
- }
- }
- ",
- ],
- ]
+ Array []
29 | const scenario = scenarios.mismatchesIncludeNonSemverVersions();
30 | fixMismatches(getInput(scenario.disk, scenario.config),
scenario.disk);
> 31 | expect(scenario.disk.writeFileSync.mock.calls).toEqual([ | ^
32 | scenario.files['packages/a/package.json'].diskWriteWhenChanged,
33 | scenario.files['packages/b/package.json'].diskWriteWhenChanged,
34 | scenario.files['packages/d/package.json'].diskWriteWhenChanged,
at Object.<anonymous> (src/bin-fix-mismatches/fix-mismatches.spec.ts:31:54)
● fixMismatches › when dependencies are installed with different versions › removes banned/disallowed dependencies
expect(received).toEqual(expected) // deep equality
- Expected - 9
+ Received + 1
- Array [
- Array [
- StringContaining "packages/b/package.json",
- "{
- \"name\": \"b\"
- }
- ",
- ],
- ]
+ Array []
45 | const scenario = scenarios.dependencyIsBanned();
46 | fixMismatches(getInput(scenario.disk, scenario.config),
scenario.disk);
> 47 | expect(scenario.disk.writeFileSync.mock.calls).toEqual([ | ^
48 | scenario.files['packages/b/package.json'].diskWriteWhenChanged,
49 | ]);
50 | expect(scenario.log.mock.calls).toEqual([
at Object.<anonymous> (src/bin-fix-mismatches/fix-mismatches.spec.ts:47:54)
FAIL src/bin-list-mismatches/list-mismatches.spec.ts
● listMismatches › when dependencies are installed with different versions › when the dependency is a package maintained in this workspace › warns ab the workspace version
expect(received).toEqual(expected) // deep equality
- Expected - 11
+ Received + 1
- Array [
- Array [
- "- c 0.0.1",
- ],
- Array [
- " 0.1.0 in dependencies of a",
- ],
- Array [
- " 0.2.0 in devDependencies of b",
- ],
- ]
+ Array []
14 | const scenario = scenarios.dependentDoesNotMatchWorkspaceVersion();
15 | listMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
> 16 | expect(scenario.log.mock.calls).toEqual([
| ^
17 | ['- c 0.0.1'],
18 | [' 0.1.0 in dependencies of a'],
19 | [' 0.2.0 in devDependencies of b'],
at Object.<anonymous> (src/bin-list-mismatches/list-mismatches.spec.ts:16:41)
● listMismatches › when dependencies are installed with different versions › replaces non-semver dependencies with valid semver dependencies
expect(received).toEqual(expected) // deep equality
- Expected - 17
+ Received + 1
- Array [
- Array [
- "- foo 0.3.0",
- ],
- Array [
- " link:vendor/foo-0.1.0 in dependencies of a",
- ],
- Array [
- " link:vendor/foo-0.2.0 in dependencies of b",
- ],
- Array [
- " 0.3.0 in dependencies of c",
- ],
- Array [
- " 0.2.0 in dependencies of d",
- ],
- ]
+ Array []
26 | const scenario = scenarios.mismatchesIncludeNonSemverVersions();
27 | listMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
> 28 | expect(scenario.log.mock.calls).toEqual([
| ^
29 | ['- foo 0.3.0'],
30 | [' link:vendor/foo-0.1.0 in dependencies of a'],
31 | [' link:vendor/foo-0.2.0 in dependencies of b'],
at Object.<anonymous> (src/bin-list-mismatches/list-mismatches.spec.ts:28:39)
● listMismatches › when dependencies are installed with different versions › removes banned/disallowed dependencies
expect(received).toEqual(expected) // deep equality
- Expected - 11
+ Received + 1
- Array [
- Array [
- StringMatching /Version Group 1/,
- ],
- Array [
- "✕ bar remove this dependency",
- ],
- Array [
- " 0.2.0 in dependencies of b",
- ],
- ]
+ Array []
39 | const scenario = scenarios.dependencyIsBanned();
40 | listMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
> 41 | expect(scenario.log.mock.calls).toEqual([
| ^
42 | [expect.stringMatching(/Version Group 1/)],
43 | ['✕ bar remove this dependency'],
44 | [' 0.2.0 in dependencies of b'],
at Object.<anonymous> (src/bin-list-mismatches/list-mismatches.spec.ts:41:39)
PASS src/lib/is-semver.spec.ts
PASS src/lib/collect.spec.ts
PASS src/lib/sort-by-name.spec.ts
FAIL src/bin-lint-semver-ranges/lint-semver-ranges.spec.ts
● lintSemverRanges › lists versions with ranges which do not match the
project config
expect(received).toEqual(expected) // deep equality
- Expected - 8
+ Received + 1
- Array [
- Array [
- "✕ bar 2.0.0 in dependencies of a should be ~2.0.0",
- ],
- Array [
- "✕ foo 0.1.0 in dependencies of a should be ~0.1.0",
- ],
- ]
+ Array []
12 | const scenario = scenarios.semverRangesDoNotMatchConfig(); 13 | lintSemverRanges(getInput(scenario.disk, scenario.config), scenario.disk);
> 14 | expect(scenario.log.mock.calls).toEqual([
| ^
15 | ['✕ bar 2.0.0 in dependencies of a should be ~2.0.0'],
16 | ['✕ foo 0.1.0 in dependencies of a should be ~0.1.0'],
17 | ]);
at Object.<anonymous> (src/bin-lint-semver-ranges/lint-semver-ranges.spec.ts:14:37)
FAIL src/bin-set-semver-ranges/set-semver-ranges.spec.ts
● setSemverRanges › sets all versions to use the supplied range
expect(received).toEqual(expected) // deep equality
- Expected - 13
+ Received + 1
- Array [
- Array [
- StringContaining "packages/a/package.json",
- "{
- \"name\": \"a\",
- \"dependencies\": {
- \"foo\": \"~0.1.0\",
- \"bar\": \"~2.0.0\"
- }
- }
- ",
- ],
- ]
+ Array []
12 | const scenario = scenarios.semverRangesDoNotMatchConfig(); 13 | setSemverRanges(getInput(scenario.disk, scenario.config), scenario.disk);
> 14 | expect(scenario.disk.writeFileSync.mock.calls).toEqual([
| ^
15 | scenario.files['packages/a/package.json'].diskWriteWhenChanged,
16 | ]);
17 | expect(scenario.log.mock.calls).toEqual([
at Object.<anonymous> (src/bin-set-semver-ranges/set-semver-ranges.spec.ts:14:52)
Jest: "global" coverage threshold for statements (92%) not met: 77.29%
Jest: "global" coverage threshold for branches (79%) not met: 63.07%
Jest: "global" coverage threshold for lines (93%) not met: 82.27%
Jest: "global" coverage threshold for functions (93%) not met: 80.16%
Test Suites: 7 failed, 9 passed, 16 total
Tests: 21 failed, 33 passed, 54 total
Snapshots: 0 total
Time: 16.402 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Windows doesn't respond or stops working on Surface
If Windows starts up slowly, runs slowly, or stops responding (freezes) on your Surface, here's info to help you get it working again....
Read more >Advanced troubleshooting for Windows boot problems
Learn to troubleshoot when Windows can't boot. This article includes advanced troubleshooting techniques intended for use by support agents ...
Read more >Troubleshooting Windows HLK Test Failures | Microsoft Learn
Install latest updates and filters. Review the Status icons. Make sure that the test was run correctly. Check for configuration changes.
Read more >Error: Windows Explorer has stopped working
Troubleshoot issues where you receive the error: "Windows Explorer has stopped working" on Windows 7 and Windows Vista.
Read more >Unexplained Windows or software behavior may be caused ...
Describes behavior that may occur if your computer has deceptive software that is installed and running, and describes steps that you can take...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Going to close this I think @mxro, the GitHub Actions runs on Windows OK – if more users have issues on Windows I’m happy to take a look.
Thanks a lot. It’s a curious one, will see what I can find out.