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

test not running in watch mode by default #319

Closed
tylerthehaas opened this issue Nov 10, 2019 · 12 comments · Fixed by #366
Closed

test not running in watch mode by default #319

tylerthehaas opened this issue Nov 10, 2019 · 12 comments · Fixed by #366
Labels
kind: feature New feature or request scope: docs Documentation could be improved. Or changes that only affect docs

Comments

@tylerthehaas
Copy link

Current Behavior

yarn test isn't running in interactive mode

Expected behavior

to have tests run in interactive/watch mode.

Suggested solution(s)

run jest in watch mode when tsdx test is run.

Your environment

Software Version(s)
TSDX 0.11.0
TypeScript 3.7.2
Browser N/A
npm/Yarn Yarn
Node 12.8.1
Operating System MacOS Mojave version 10.14.4
@swyxio
Copy link
Collaborator

swyxio commented Dec 4, 2019

can you suggest a way to pass thru all flags down into jest? this might help support all of jest's other features.

@tylerthehaas
Copy link
Author

tylerthehaas commented Dec 4, 2019

I wonder if we can use bash's $@ as mentioned in this post:

https://stackoverflow.com/a/3816747/6107169

something like jest -- "$@"

@swyxio
Copy link
Collaborator

swyxio commented Dec 5, 2019

eh i think we have better ways to do that programmatically. but feel free to open up a pr and do what works!

@tylerthehaas
Copy link
Author

what do you suggest?

@swyxio
Copy link
Collaborator

swyxio commented Dec 5, 2019

not sure but check this out:

tsdx/src/index.ts

Lines 559 to 581 in c5f65bc

const argv = process.argv.slice(2);
let jestConfig = {
...createJestConfig(
relativePath => path.resolve(__dirname, '..', relativePath),
paths.appRoot
),
...appPackageJson.jest,
};
try {
// Allow overriding with jest.config
const jestConfigContents = require(paths.jestConfig);
jestConfig = { ...jestConfig, ...jestConfigContents };
} catch {}
argv.push(
'--config',
JSON.stringify({
...jestConfig,
})
);
const [, ...argsToPassToJestCli] = argv;
jest.run(argsToPassToJestCli);
and see how you'd change

@arthurdenner
Copy link
Contributor

@tylerthehaas, sorry if I misunderstood, but isn't yarn test --watch what you need?

@jaredpalmer
Copy link
Owner

Yeah all we should do is key off of whether CI=true IMHO

@swyxio
Copy link
Collaborator

swyxio commented Dec 11, 2019

that works. nice 1-2 liner.

@MartijnHols
Copy link

Previously I could use yarn test for a single run and yarn test --watch for watching. Is it no longer possible to make it run just once outside of CI now?

@ambroseus
Copy link
Contributor

ambroseus commented Dec 17, 2019

@MartijnHols just add CI=true explicitly
"test": "CI=true tsdx test --color"
"test:coverage": "CI=true tsdx test --color --coverage"

@swyxio
Copy link
Collaborator

swyxio commented Dec 17, 2019

or ctrl + C to kill :)

lookfirst added a commit to lookfirst/tsdx that referenced this issue Dec 20, 2019
swyxio pushed a commit that referenced this issue Dec 20, 2019
@swyxio
Copy link
Collaborator

swyxio commented Jan 9, 2020

@MartijnHols @ambroseus we are reverting the "watch mode by default" behavior we added a month ago - sorry for the flipflop. more info #408

@agilgur5 agilgur5 changed the title test command not running in watch mode test not running in watch mode by default May 12, 2020
Repository owner locked as resolved and limited conversation to collaborators May 12, 2020
@agilgur5 agilgur5 added kind: feature New feature or request scope: docs Documentation could be improved. Or changes that only affect docs labels Sep 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: feature New feature or request scope: docs Documentation could be improved. Or changes that only affect docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants