Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for coverage files relative to shifter config #101

Closed
wants to merge 1 commit into from

Conversation

andrewnicols
Copy link
Contributor

I've recently been trying to build coverage reports from shifted modules and hit this issue on the way.
At present, all coverage files are built with the name and filename set as:

'build/' + filename + '/' + filename + '.js'

When istanbul then comes along to produce the report, it tries to find the source files at this path; however, when building in a recursive or distributed situation and where build is not in your immediate path, this leads to unresolvable .js files.

This change sets an internal relativeTo option to shifter which is then used when instrumenting the -coverage.js files so that each file is built relative to the configuration. This is only done when the configuration file:

  • exists; and
  • contains the parameter coverageRelativeToConfig: true

In a nested structure such as:

.
├── .shifter.json
└── path
    └── to
        └── yui
            ├── build
            │   └── somemodule
            │       ├── somemodule-coverage.js
            │       ├── somemodule-debug.js
            │       ├── somemodule-min.js
            │       └── somemodule.js
            └── src
                └── somemodule
                    ├── build.json
                    ├── js
                    │   └── somemodule.js
                    └── meta
                        └── somemodule.json

Instead of the path being set to:

build/somemodule/somemodule.js

It will be set to

path/to/yui/build/somemodule/somemodule.js

When it comes to creating the istanbul reports, this is now resolvable.

@caridy
Copy link
Member

caridy commented Sep 5, 2013

This is already supported, probably not well documented though, but you should be able to add this to your .shifter.json file:

"build-dir": "./path/to/yui/build"

and shifter will automatically resolve that relative to the .shifter.json file. More details here:
https://github.com/yui/shifter/blob/master/lib/index.js#L89-L107

@caridy caridy closed this Sep 5, 2013
@andrewnicols
Copy link
Contributor Author

Hi Caridy,

Unfortunately not for recursive builds where the build-dir is relative to
the source directory and thus can't be set in config.

See #66 which forcibly sets the build-dir to a relative path on recursive
builds.

On 5 September 2013 02:08, Caridy Patino notifications@github.com wrote:

This is already supported, probably not well documented though, but you
should be able to add this to your .shifter.json file:

"build-dir": "./path/to/yui/build"

and shifter will automatically resolve that relative to the .shifter.jsonfile. More details here:
https://github.com/yui/shifter/blob/master/lib/index.js#L89-L107


Reply to this email directly or view it on GitHubhttps://github.com//pull/101#issuecomment-23837650
.

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

Successfully merging this pull request may close these issues.

2 participants