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

extra files are passed to AVA when following after another fly task #13

Open
frantic1048 opened this issue Mar 30, 2017 · 6 comments
Open

Comments

@frantic1048
Copy link

Let's say we have such a flyfile.js

exports.foo = function* foo (fly) {
  yield fly.source('./src/index.js').target('build/index.js')
}

exports.test = function* test (fly) {
  yield fly.start('foo')
  yield fly.source('./test/index.js').ava() // error
}

exports.test_another = function* test_another (fly) {
  yield fly.source('./src/index.js').target('build/index.js')
  yield fly.source('./test/index.js').ava() // works
}

./src/index.js is just a blank file.

./test/index.js is a regular AVA test file:

import test from 'ava'

test('foo', t => {
  t.pass()
})

Fly will fail test task with error: test failed because No tests found in src/index.js, make sure to import "ava" at the top of your test file. Even I just source('./test/index.js') to AVA.

But task_another runs well.

I'm not sure if this is an fly issue.

@lukeed
Copy link

lukeed commented Mar 30, 2017

It's a Fly bug that's been on my todo list.

When you run tasks from inside other tasks, there's a rare chance that the source files will cross over. I think I know why, but haven't had time to do it yet.

For now, either define your task order via the CLI/NPM command definition:

{
  "test": "fly build test"
}

Or use fly.serial or fly.parallel instead of fly.start inside your task.

@frantic1048
Copy link
Author

frantic1048 commented Mar 30, 2017

Thanks for the explaination, I know how to workaround this.

By the way, I found fly.serial also make the source files cross over, like this:

exports.test = function* test (fly) {
  yield fly.serial(['foo'])
  yield fly.source('./test/index.js').ava() // error
}

@lukeed
Copy link

lukeed commented Mar 30, 2017

Yeah, sorry. The best and most reliable way is to chain your commands from the NPM script.

{
  "test": "fly foo test"
}

@pine
Copy link
Member

pine commented Apr 10, 2017

Is this the fly-ava plugin bug? @frantic1048 @lukeed

@lukeed
Copy link

lukeed commented Apr 10, 2017

@pine Nope, this is a Fly bug.

@pine
Copy link
Member

pine commented Apr 11, 2017

OK! Thanks.

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

3 participants