Browse Source

Add test : handle external is a function in config.

semi-dynamic-namespace-imports
operandom 8 years ago
parent
commit
a335283a73
  1. 4
      test/cli/config-external-function/_config.js
  2. 8
      test/cli/config-external-function/_expected.js
  3. 6
      test/cli/config-external-function/main.js
  4. 25
      test/cli/config-external-function/rollup.config.js

4
test/cli/config-external-function/_config.js

@ -0,0 +1,4 @@
module.exports = {
description: 'external option gets passed from config',
command: 'rollup -c -e assert,external-module'
};

8
test/cli/config-external-function/_expected.js

@ -0,0 +1,8 @@
'use strict';
var ___config_js = require('./_config.js');
var assert = require('assert');
var externalModule = require('external-module');
assert.ok( ___config_js.execute );
externalModule.method();

6
test/cli/config-external-function/main.js

@ -0,0 +1,6 @@
import { execute } from './_config.js';
import { ok } from 'assert';
import { method } from 'external-module';
ok( execute );
method();

25
test/cli/config-external-function/rollup.config.js

@ -0,0 +1,25 @@
import assert from 'assert';
import { resolve, sep } from 'path';
var config = resolve( './_config.js' ).split(sep).join('/');
export default {
entry: 'main.js',
format: 'cjs',
external: function (id) {
if (id === config) {
return true;
}
return false;
},
plugins: [
{
load: function ( id ) {
assert.notEqual( id, config );
}
}
]
};
Loading…
Cancel
Save