mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-02 08:56:11 +00:00
fix fs layer (#1004)
This commit is contained in:
parent
8c28a597d8
commit
ec9307c991
@ -5,6 +5,11 @@ let fs = require('fs-extra');
|
||||
let utils = require('../utils/utils.js');
|
||||
require('colors');
|
||||
|
||||
// set PWD to process.cwd() since Windows doesn't have a value for PWD
|
||||
if (!process.env.PWD) {
|
||||
process.env.PWD = process.cwd();
|
||||
}
|
||||
|
||||
// set the anchor for embark's fs.dappPath()
|
||||
if (!process.env.DAPP_PATH) {
|
||||
process.env.DAPP_PATH = process.env.PWD;
|
||||
@ -20,11 +25,6 @@ if (!process.env.PKG_PATH) {
|
||||
process.env.PKG_PATH = process.env.PWD;
|
||||
}
|
||||
|
||||
// set PWD to process.cwd() since Windows doesn't have a value for PWD
|
||||
if (!process.env.PWD) {
|
||||
process.env.PWD = process.cwd();
|
||||
}
|
||||
|
||||
const pathConfigs = {
|
||||
DAPP_PATH: process.env.DAPP_PATH,
|
||||
EMBARK_PATH: process.env.EMBARK_PATH,
|
||||
|
12
test/fs.js
12
test/fs.js
@ -2,17 +2,29 @@
|
||||
const {assert} = require('chai');
|
||||
const os = require('os');
|
||||
|
||||
const underlyingFs = require('fs-extra');
|
||||
const fs = require('../lib/core/fs');
|
||||
|
||||
describe('fs', () => {
|
||||
let fsMethods = {};
|
||||
|
||||
before(() => {
|
||||
this.oldProcessExit = process.exit;
|
||||
process.exit = function() {};
|
||||
|
||||
for(const method in underlyingFs) {
|
||||
fsMethods[method] = underlyingFs[method];
|
||||
underlyingFs[method] = function() {};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
after(() => {
|
||||
process.exit = this.oldProcessExit;
|
||||
|
||||
for(const method in underlyingFs) {
|
||||
underlyingFs[method] = fsMethods[method];
|
||||
}
|
||||
});
|
||||
|
||||
const helperFunctions = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user