From 47ccb24d3caa62da5e59471485fc1e2976b331bb Mon Sep 17 00:00:00 2001 From: Michel Rasschaert Date: Sun, 28 Jan 2018 18:56:26 +0100 Subject: [PATCH] ignore files and folders starting with dot in the tests also switch folder to the fixture directory because some rollup plugins rely on `process.cwd()`. --- test/index.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/index.test.js b/test/index.test.js index c5f5826..6946534 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -12,7 +12,7 @@ const constant = konst => () => konst; const printTree = (nodes, indentLevel = 0) => { const indent = join(times(indentLevel, constant(' '))); - return join(nodes.map(node => + return join(nodes.filter(node => node.name[0] !== '.').map(node => `${indent}${node.name}\n${node.type === 'directory' ? printTree(node.children, indentLevel + 1) : ''}` )); }; @@ -26,10 +26,13 @@ describe('fixtures', () => { } it(fixtureDir, async () => { + const prevDir = process.cwd(); + process.chdir(path.resolve(fixturePath)); const output = await microbundle({ cwd: path.resolve(fixturePath), formats: 'es,cjs,umd' }); + process.chdir(prevDir); const printedDir = printTree([dirTree(fixturePath)]);