Skip to content

Commit

Permalink
Chore: Jest running on Windows (#8864)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSodaSea authored and bigtimebuddy committed Dec 12, 2022
1 parent 01ab1aa commit fd4cf83
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -77,6 +77,7 @@
"rollup-plugin-rename-node-modules": "^1.3.1",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-string": "^3.0.0",
"tree-kill": "^1.2.2",
"ts-jest": "^26.0.0",
"ts-node": "^9.0.0",
"tsconfig-paths": "^3.10.1",
Expand Down
9 changes: 8 additions & 1 deletion test/jest-global-setup.ts
Expand Up @@ -6,7 +6,14 @@ module.exports = async function ()
{
if (!process.env.GITHUB_ACTIONS)
{
const httpServerProcess = spawn('http-server', ['-c-1', `${join(process.cwd(), './packages')}`]);
const httpServerProcess = spawn(
'http-server',
['-c-1', `${join(process.cwd(), './packages')}`],
{
// See https://nodejs.org/api/child_process.html#spawning-bat-and-cmd-files-on-windows
shell: process.platform === 'win32',
},
);

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down
3 changes: 2 additions & 1 deletion test/jest-global-teardown.ts
@@ -1,4 +1,5 @@
import type { ChildProcess } from 'child_process';
import kill from 'tree-kill';

// eslint-disable-next-line func-names
module.exports = async function ()
Expand All @@ -14,7 +15,7 @@ module.exports = async function ()
httpServerProcess.on('close', resolve);
});

httpServerProcess.kill();
kill(httpServerProcess.pid);
await processClose;
}
};

0 comments on commit fd4cf83

Please sign in to comment.