import mix from '../src/index';
import test from 'ava';

test('that it can merge config', t => {
    Config.merge({
        versioning: true,
        foo: 'bar'
    });

    t.is('bar', Config.foo);
    t.true(Config.versioning);
});


test('that it intelligently builds the Babel config', t => {
    // Given the user has a custom .babelrc file...
    new File('.babelrc').write({
        'plugins': ['transform-object-rest-spread']
    });

    // And we construct the Babel config for Mix...
    let options = Config.babel();

    // Then it should smartly merge the user's .babelrc with Mix's.
    t.deepEqual(['transform-object-rest-spread'], options.plugins)
    t.is('env', options.presets[0][0]);

    // Clean up.
    File.find('.babelrc').delete();
});

import mix from '../src/index';
import test from 'ava';

test('that it can merge config', t => {
    Config.merge({
        versioning: true,
        foo: 'bar'
    });

    t.is('bar', Config.foo);
    t.true(Config.versioning);
});


test('that it intelligently builds the Babel config', t => {
    // Given the user has a custom .babelrc file...
    new File('.babelrc').write({
        'plugins': ['arbitrary-plugin']
    });

    // And we construct the Babel config for Mix...
    let options = Config.babel();

    // Then it should smartly merge the user's .babelrc with Mix's.
    t.deepEqual(['transform-object-rest-spread', 'arbitrary-plugin'], options.plugins)
    t.is('env', options.presets[0][0]);

    // Clean up.
    File.find('.babelrc').delete();
});

Fix failing test by adapting it to new conditions
Fix failing test by adapting it to new conditions

The test failed, because there were two entries
'transform-object-rest-spread' in the options.plugins array.

This has most likely to do with src/config.js which declares
'transform-object-rest-spread' as a default plugin.
