Skip to content

Commit

Permalink
test: refactor (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Jul 26, 2019
1 parent ff0c736 commit f848140
Show file tree
Hide file tree
Showing 20 changed files with 2,819 additions and 1,781 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@ npm-debug.log*
/local
/reports
/node_modules
/test/helpers/\[special\?directory\]

.DS_Store
Thumbs.db
Expand Down
26 changes: 26 additions & 0 deletions globalSetup.js
@@ -0,0 +1,26 @@
const path = require('path');
const fs = require('fs');

// eslint-disable-next-line import/no-extraneous-dependencies
const mkdirp = require('mkdirp');

const removeIllegalCharacterForWindows = require('./test/utils/removeIllegalCharacterForWindows');

const baseDir = path.resolve(__dirname, 'test/helpers');

const specialFiles = {
'[special?directory]/nested/nestedfile.txt': '',
'[special?directory]/(special-*file).txt': 'special',
'[special?directory]/directoryfile.txt': 'new',
};

module.exports = () => {
Object.keys(specialFiles).forEach((originFile) => {
const file = removeIllegalCharacterForWindows(originFile);
const dir = path.dirname(file);

mkdirp.sync(path.join(baseDir, dir));

fs.writeFileSync(path.join(baseDir, file), specialFiles[originFile]);
});
};
3 changes: 3 additions & 0 deletions jest.config.js
@@ -0,0 +1,3 @@
module.exports = {
globalSetup: '<rootDir>/globalSetup.js',
};
2 changes: 2 additions & 0 deletions src/processPattern.js
Expand Up @@ -12,6 +12,8 @@ export default function processPattern(globalRef, pattern) {
{
cwd: pattern.context,
follow: true,
// Todo in next major release
// dot: false
},
pattern.globOptions || {}
);
Expand Down

0 comments on commit f848140

Please sign in to comment.