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

Watch mode / hot reload #381

Open
mrchantey opened this issue Feb 19, 2022 · 2 comments
Open

Watch mode / hot reload #381

mrchantey opened this issue Feb 19, 2022 · 2 comments

Comments

@mrchantey
Copy link

Does as-pect support a watch mode?
At the moment i'm using onchange but its a little clunky and I cant get working outside of npm scripts:

//-i = run on start, -k = kill previous on change
npx onchange -i -k \"assembly/**/*.ts\" -- npx asp

If there's interest I could have a look at implementing it and creating a PR, here's the code I use for some other scripts:

import fs from 'fs-extra'
export const watchDirectory = (dir: string, onChange: (val: 'rename' | 'change') => any, runOnStart = true) => {
	if (runOnStart)
		onChange('change')
	return fs.watch(dir, { recursive: true }, onChange)
}
@willemneal
Copy link
Collaborator

There isn't a watch mode, but others have had success with https://www.npmjs.com/package/watch. If you don't find that suitable, feel free to submit a PR!

@mrchantey mrchantey mentioned this issue Feb 21, 2022
@mrchantey
Copy link
Author

As a side note, just found out the reason i couldnt get onchange working properly is an npm-powershell bug about using double slash -- to pass arguments.
Current solution is to use triple slash npm run test --- -f=myTest
ah well, PR is up now 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants