mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-08 20:05:44 +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');
|
let utils = require('../utils/utils.js');
|
||||||
require('colors');
|
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()
|
// set the anchor for embark's fs.dappPath()
|
||||||
if (!process.env.DAPP_PATH) {
|
if (!process.env.DAPP_PATH) {
|
||||||
process.env.DAPP_PATH = process.env.PWD;
|
process.env.DAPP_PATH = process.env.PWD;
|
||||||
@ -20,11 +25,6 @@ if (!process.env.PKG_PATH) {
|
|||||||
process.env.PKG_PATH = process.env.PWD;
|
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 = {
|
const pathConfigs = {
|
||||||
DAPP_PATH: process.env.DAPP_PATH,
|
DAPP_PATH: process.env.DAPP_PATH,
|
||||||
EMBARK_PATH: process.env.EMBARK_PATH,
|
EMBARK_PATH: process.env.EMBARK_PATH,
|
||||||
|
12
test/fs.js
12
test/fs.js
@ -2,17 +2,29 @@
|
|||||||
const {assert} = require('chai');
|
const {assert} = require('chai');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
|
||||||
|
const underlyingFs = require('fs-extra');
|
||||||
const fs = require('../lib/core/fs');
|
const fs = require('../lib/core/fs');
|
||||||
|
|
||||||
describe('fs', () => {
|
describe('fs', () => {
|
||||||
|
let fsMethods = {};
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
this.oldProcessExit = process.exit;
|
this.oldProcessExit = process.exit;
|
||||||
process.exit = function() {};
|
process.exit = function() {};
|
||||||
|
|
||||||
|
for(const method in underlyingFs) {
|
||||||
|
fsMethods[method] = underlyingFs[method];
|
||||||
|
underlyingFs[method] = function() {};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
after(() => {
|
after(() => {
|
||||||
process.exit = this.oldProcessExit;
|
process.exit = this.oldProcessExit;
|
||||||
|
|
||||||
|
for(const method in underlyingFs) {
|
||||||
|
underlyingFs[method] = fsMethods[method];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const helperFunctions = [
|
const helperFunctions = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user