Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/v0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
occar421 committed Apr 1, 2018
2 parents 730862d + 09affbe commit 4dd0fe2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "transmit-update-loader",
"version": "0.1.1",
"version": "0.1.2",
"description": "Message passing tool to transmit update to another file during webpack loader process.",
"main": "src/loader.js",
"repository": "https://github.com/occar421/transmit-update-loader",
Expand All @@ -25,6 +25,6 @@
"touch": "^3.1.0"
},
"scripts": {
"test": "jest"
"test": "jest --runInBand"
}
}
15 changes: 7 additions & 8 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ export const fileStatAsync = fileName =>

/**
* @param {string} dirPath
* @returns {Promise<array<string>>}
* @returns {array<string>}
*/
const enumerateFilesAsync = dirPath =>
const enumerateFiles = dirPath =>
fs
.readdir(dirPath)
.then(files =>
files.map(f => path.join(dirPath, f)).filter(f => fs.statSync(f).isFile())
);
.readdirSync(dirPath)
.map(f => path.join(dirPath, f))
.filter(f => fs.statSync(f).isFile());

/**
* @param {string} fileName
Expand All @@ -33,8 +32,8 @@ const enumerateFilesAsync = dirPath =>
export const existsAsync = fileName =>
fs.pathExists(path.join(__dirname, fileName));

export const removeGeneratedFiles = async () => {
const files = await enumerateFilesAsync(path.join(__dirname, "fixtures"));
export const removeGeneratedFiles = () => {
const files = enumerateFiles(path.join(__dirname, "fixtures"));
files.filter(f => f.endsWith(".null")).forEach(f => {
fs.unlink(f, err => {
if (err && err.code !== "ENOENT") throw err;
Expand Down
2 changes: 1 addition & 1 deletion test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ it("should not affect source file content", async () => {
const sourceFileName = "./fixtures/foo.txt";
const preSourceFileContent = await readFileAsync(sourceFileName);
await compiler(sourceFileName, {
transmitRules: [{ test: /\/(.*$)/, targets: ["$1.null"] }],
transmitRules: [{ test: /(.*$)/, targets: ["$1.null"] }],
noCreate: false
});
const postSourceFileContent = await readFileAsync(sourceFileName);
Expand Down

0 comments on commit 4dd0fe2

Please sign in to comment.