{"size": 1181, "ext": "js", "max_stars_repo_path": "test/snowpack/config/buildOptions.out/index.test.js", "max_stars_repo_name": "LukeChannings/snowpack", "max_stars_repo_stars_event_min_datetime": "2020-01-06T14:26:26.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-16T21:40:04.000Z", "max_issues_repo_path": "test/snowpack/config/buildOptions.out/index.test.js", "max_issues_repo_name": "LukeChannings/snowpack", "max_issues_repo_issues_event_min_datetime": "2020-10-17T00:00:04.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-23T18:41:25.000Z", "max_forks_repo_path": "test/snowpack/config/buildOptions.out/index.test.js", "max_forks_repo_name": "LukeChannings/snowpack", "max_forks_repo_forks_event_min_datetime": "2020-10-16T23:56:39.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-23T08:57:30.000Z"}
{"max_stars_count": 8020, "max_issues_count": 1316, "max_forks_count": 758, "avg_line_length": 26.8409090909, "max_line_length": 74, "alphanum_fraction": 0.5241320914}
const {testFixture} = require('../../../fixture-utils');
const dedent = require('dedent');

describe('buildOptions.out', () => {
  beforeAll(() => {
    // Needed until we make Snowpack's JS Build Interface quiet by default
    require('snowpack').logger.level = 'error';
  });

  it('builds to the correct relative out path', async () => {
    const result = await testFixture(
      {
        'index.js': `// Intentionally left blank`,
        'snowpack.config.js': dedent`
          module.exports = {
            buildOptions: {
              out: 'TEST_OUT'
            }
          }
        `,
      },
      {absolute: true},
    );
    expect(Object.keys(result).every((f) => f.includes('TEST_OUT')));
  });

  it('builds to the correct absolute out path', async () => {
    const result = await testFixture(
      {
        'index.js': `// Intentionally left blank.`,
        'snowpack.config.js': dedent`
          module.exports = {
            buildOptions: {
              out: '%TEMP_TEST_DIRECTORY%/TEST_OUT'
            }
          }
        `,
      },
      {absolute: true},
    );
    expect(Object.keys(result).every((f) => f.includes('TEST_OUT')));
  });
});
