Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Mar 29, 2020
1 parent 1a289c3 commit 47d86be
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/cli/samples/watch/bundle-error/_config.js
@@ -0,0 +1,22 @@
const fs = require('fs');
const path = require('path');

let mainFile;

module.exports = {
description: 'recovers from errors during bundling',
command: 'rollup -cw',
before() {
mainFile = path.resolve(__dirname, 'main.js');
fs.writeFileSync(mainFile, '<=>');
},
abortOnStderr(data) {
if (data.includes('Error: Unexpected token')) {
fs.writeFileSync(mainFile, 'export default 42;');
return false;
}
if (data.includes('created _actual')) {
return true;
}
},
};
3 changes: 3 additions & 0 deletions test/cli/samples/watch/bundle-error/_expected/main.js
@@ -0,0 +1,3 @@
var main = 42;

export default main;
1 change: 1 addition & 0 deletions test/cli/samples/watch/bundle-error/main.js
@@ -0,0 +1 @@
export default 42;
7 changes: 7 additions & 0 deletions test/cli/samples/watch/bundle-error/rollup.config.js
@@ -0,0 +1,7 @@
export default {
input: 'main.js',
output: {
dir: "_actual",
format: "es"
}
};
9 changes: 9 additions & 0 deletions test/cli/samples/watch/no-config-file/_config.js
@@ -0,0 +1,9 @@
module.exports = {
description: 'watches without a config file',
command: 'rollup main.js --watch --format es --file _actual/main.js',
abortOnStderr(data) {
if (data.includes('created _actual/main.js')) {
return true;
}
},
};
3 changes: 3 additions & 0 deletions test/cli/samples/watch/no-config-file/_expected/main.js
@@ -0,0 +1,3 @@
const foo = 42;

export { foo };
1 change: 1 addition & 0 deletions test/cli/samples/watch/no-config-file/main.js
@@ -0,0 +1 @@
export const foo = 42;
9 changes: 9 additions & 0 deletions test/cli/samples/watch/node-config-file/_config.js
@@ -0,0 +1,9 @@
module.exports = {
description: 'watches using a node_modules config files',
command: 'rollup --watch --config node:custom',
abortOnStderr(data) {
if (data.includes('created _actual/main.js')) {
return true;
}
},
};
3 changes: 3 additions & 0 deletions test/cli/samples/watch/node-config-file/_expected/main.js
@@ -0,0 +1,3 @@
const foo = 42;

export { foo };
1 change: 1 addition & 0 deletions test/cli/samples/watch/node-config-file/main.js
@@ -0,0 +1 @@
export const foo = 42;

0 comments on commit 47d86be

Please sign in to comment.