From 525e3de4ed66b22295840d9679126fff76110272 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 9 Jan 2017 20:48:22 -0500 Subject: [PATCH] deal with warnings, to make test output clearer --- test/form/conflicting-imports/_config.js | 5 ++++- test/form/custom-module-context-function/_config.js | 3 +++ test/form/custom-module-context/_config.js | 3 +++ test/form/export-default-import/_config.js | 1 + .../external-imports-custom-names-function/_config.js | 1 + test/form/external-imports/_config.js | 5 ++++- .../import-external-namespace-and-default/_config.js | 5 ++++- test/form/interop-false/_config.js | 1 + test/form/paths-function/_config.js | 1 + test/form/paths/_config.js | 1 + test/form/prefer-const/_config.js | 1 + test/form/side-effect-es5-classes/_config.js | 7 ++++++- test/form/unused-import/_config.js | 10 +++++++--- 13 files changed, 37 insertions(+), 7 deletions(-) diff --git a/test/form/conflicting-imports/_config.js b/test/form/conflicting-imports/_config.js index a9b8ddf..19866b1 100644 --- a/test/form/conflicting-imports/_config.js +++ b/test/form/conflicting-imports/_config.js @@ -1,3 +1,6 @@ module.exports = { - description: 'ensures bundle imports are deconflicted (#659)' + description: 'ensures bundle imports are deconflicted (#659)', + options: { + external: [ 'foo', 'bar' ] + } }; diff --git a/test/form/custom-module-context-function/_config.js b/test/form/custom-module-context-function/_config.js index c15118e..ff78bda 100644 --- a/test/form/custom-module-context-function/_config.js +++ b/test/form/custom-module-context-function/_config.js @@ -3,6 +3,9 @@ module.exports = { options: { moduleContext ( id ) { return /main\.js$/.test( id ) ? 'lolwut' : 'undefined'; + }, + onwarn ( warning ) { + if ( warning.code !== 'THIS_IS_UNDEFINED' ) throw new Error( 'unexpected warning' ); } } }; diff --git a/test/form/custom-module-context/_config.js b/test/form/custom-module-context/_config.js index f5d68d2..2fea8d1 100644 --- a/test/form/custom-module-context/_config.js +++ b/test/form/custom-module-context/_config.js @@ -3,6 +3,9 @@ module.exports = { options: { moduleContext: { 'main.js': 'lolwut' + }, + onwarn ( warning ) { + if ( warning.code !== 'THIS_IS_UNDEFINED' ) throw new Error( 'unexpected warning' ); } } }; diff --git a/test/form/export-default-import/_config.js b/test/form/export-default-import/_config.js index 860f688..8e61cf3 100644 --- a/test/form/export-default-import/_config.js +++ b/test/form/export-default-import/_config.js @@ -1,6 +1,7 @@ module.exports = { description: 'correctly exports a default import, even in ES mode (#513)', options: { + external: [ 'x' ], moduleName: 'myBundle' } }; diff --git a/test/form/external-imports-custom-names-function/_config.js b/test/form/external-imports-custom-names-function/_config.js index cbc42c4..b718b24 100644 --- a/test/form/external-imports-custom-names-function/_config.js +++ b/test/form/external-imports-custom-names-function/_config.js @@ -1,6 +1,7 @@ module.exports = { description: 'allows globals to be specified as a function', options: { + external: [ 'a-b-c' ], globals: function ( id ) { return id.replace( /-/g, '_' ); } diff --git a/test/form/external-imports/_config.js b/test/form/external-imports/_config.js index 059b878..4a74d8a 100644 --- a/test/form/external-imports/_config.js +++ b/test/form/external-imports/_config.js @@ -1,6 +1,9 @@ module.exports = { description: 'prefixes global names with `global.` when creating UMD bundle (#57)', options: { - external: [ 'factory', 'baz', 'shipping-port', 'alphabet' ] + external: [ 'factory', 'baz', 'shipping-port', 'alphabet' ], + onwarn: warning => { + if ( warning.code !== 'UNUSED_EXTERNAL_IMPORT' ) throw new Error( 'unexpected warning' ); + } } }; diff --git a/test/form/import-external-namespace-and-default/_config.js b/test/form/import-external-namespace-and-default/_config.js index 5ee7b48..2f8b72c 100644 --- a/test/form/import-external-namespace-and-default/_config.js +++ b/test/form/import-external-namespace-and-default/_config.js @@ -1,3 +1,6 @@ module.exports = { - description: 'disinguishes between external default and namespace (#637)' + description: 'disinguishes between external default and namespace (#637)', + options: { + external: [ 'foo' ] + } }; diff --git a/test/form/interop-false/_config.js b/test/form/interop-false/_config.js index 0076e3a..1da8c56 100644 --- a/test/form/interop-false/_config.js +++ b/test/form/interop-false/_config.js @@ -1,6 +1,7 @@ module.exports = { description: 'getInterop with interop: false', options: { + external: [ 'core/view' ], moduleName: 'foo', interop: false } diff --git a/test/form/paths-function/_config.js b/test/form/paths-function/_config.js index 2d1f055..309755e 100644 --- a/test/form/paths-function/_config.js +++ b/test/form/paths-function/_config.js @@ -1,6 +1,7 @@ module.exports = { description: 'external paths (#754)', options: { + external: [ 'foo' ], paths: id => `https://unpkg.com/${id}` } }; diff --git a/test/form/paths/_config.js b/test/form/paths/_config.js index 1d6ed03..bb4bae9 100644 --- a/test/form/paths/_config.js +++ b/test/form/paths/_config.js @@ -1,6 +1,7 @@ module.exports = { description: 'external paths (#754)', options: { + external: [ 'foo' ], paths: { foo: 'https://unpkg.com/foo' } diff --git a/test/form/prefer-const/_config.js b/test/form/prefer-const/_config.js index ebb4828..f5026ef 100644 --- a/test/form/prefer-const/_config.js +++ b/test/form/prefer-const/_config.js @@ -1,6 +1,7 @@ module.exports = { description: 'uses const instead of var if specified (#653)', options: { + external: [ 'other' ], preferConst: true, moduleName: 'myBundle' } diff --git a/test/form/side-effect-es5-classes/_config.js b/test/form/side-effect-es5-classes/_config.js index 380a44e..027b754 100644 --- a/test/form/side-effect-es5-classes/_config.js +++ b/test/form/side-effect-es5-classes/_config.js @@ -1,3 +1,8 @@ module.exports = { - description: 'omits ES5 classes which are pure (e.g. they only assign to `this`)' + description: 'omits ES5 classes which are pure (e.g. they only assign to `this`)', + options: { + onwarn ( warning ) { + if ( warning.code !== 'THIS_IS_UNDEFINED' ) throw new Error( 'unexpected warning' ); + } + } }; diff --git a/test/form/unused-import/_config.js b/test/form/unused-import/_config.js index ddcd500..5e00536 100644 --- a/test/form/unused-import/_config.js +++ b/test/form/unused-import/_config.js @@ -1,5 +1,9 @@ -const assert = require( 'assert' ); - module.exports = { - description: 'excludes unused imports ([#595])' + description: 'excludes unused imports ([#595])', + options: { + external: [ 'external' ], + onwarn ( warning ) { + if ( warning.code !== 'UNUSED_EXTERNAL_IMPORT' && warning.code !== 'EMPTY_BUNDLE' ) throw new Error( 'unexpected warning' ); + } + } };