Installing with Composer causes unit tests to fail I installed with Drupal with Composer (using drupal-scaffold) with Drupal files placed inside the web directory. When I run unit tests, two of them fail because Drupal expects to find the composer.json file inside the web directory whereas in my case composer.json is in the project root (which is obvious place for it).

Is this an issue with my configuration, or is it a problem with unit tests that make wrong assumptions?

The failing tests are 
Drupal\Tests\ComposerIntegrationTest::testComposerJson and Drupal\Tests\ComposerIntegrationTest::testComposerLockHash. Both fail with the following error message.


  file_get_contents(web/composer.json): failed to open stream: No such file or directory
Drupal with Composer uses the drupal-scaffold script which you mentioned. It seems that it does not include the composer.json and composer.lock files by default. 

But the files are there: http://cgit.drupalcode.org/drupal/plain/

Looking at the plugin documentation on github in the Configuration section reveals that the composer.json and composer.lock files are not on the list to be included by default. 

But the plugin is configurable, and you can actually specify the name of the files that should be additionally included.

So adding this in the extra section of your composer.json:

"drupal-scaffold" : {
    "includes" : [
        "composer.json",
        "composer.lock"
    ]
}


followed by running composer drupal-scaffold OR removing web/core directory and running composer install should get you the required files and make the tests pass.x