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

how to make editsource:edit to run before tests #9

Open
max8github opened this issue Apr 5, 2016 · 4 comments
Open

how to make editsource:edit to run before tests #9

max8github opened this issue Apr 5, 2016 · 4 comments

Comments

@max8github
Copy link

After trying and re-trying , was not able to use this plugin to do token substitution before unit tests are run.

Maybe i am not using sbt well enough, but i was trying something as easy as:

test <<= (test in Test) dependsOn (edit in EditSource)

to make tests do their work after token resolution, but it does not work.
Maybe i am missing something obvious, but it would still be great if this were in the instructions, i think, which i could add myself if so desired.

Please note that when i run sbt editsource:edit it does work: files under target are resolved.

But when i run sbt test, my unit tests fail: if i look into the target dir, the files that were correctly resolved by editsource:edit are now unresolved (they contain ${baseDirectory} strings inside them).

@bmc
Copy link
Owner

bmc commented Apr 6, 2016

I'll have to look into this one. I never intended this to be used during testing, but it's a reasonable request.

@max8github
Copy link
Author

Yes, that would be nice. I wish i could help right away, actually, but still have to learn a bit more on how to code sbt plugins and all.

(BTW, if i may ask: if you could share a tentative, rough and uncommitted time on when you could possibly get to it, please let me know: that will help me plan how to get over this problem in the short-medium term)

@max8github
Copy link
Author

(To give context to this, if you are interested, this is about setting up unit tests with an in-memory database like h2 or hsqldb. In either case, when i create a Connection object in unit tests, the url cannot contain a relative file path: Connection requires it to be absolute. So, if i want to save the url string in application.conf under source control, i must use ${baseDirectory} in it)

@bmc
Copy link
Owner

bmc commented Jan 7, 2018

With the latest version, this might work:

test in Test := ((test in Test) dependsOn (edit in EditSource)).value

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