HuddleEng / PhantomFlow

Describe and visualise user flows through tests with PhantomJS
MIT License
682 stars 60 forks source link

Error running example #56

Closed haoyangnz closed 7 years ago

haoyangnz commented 7 years ago

What I ran:

git clone https://github.com/Huddle/PhantomFlow.git
cd PhantomFlow
npm install
node test/test.js

What I get:

Parallelising 2 test files on 2 processes.

Picking up job: flows/responsive.test.js
[flows/responsive.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.
[flows/responsive.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.

 Please take a look at the error log for more info '/home/haoyang.feng/mos/work/PhantomFlow/test-results/log/error_2.log'
Picking up job: flows/coffeemachine.test.js
[flows/coffeemachine.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.
[flows/coffeemachine.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.

 Please take a look at the error log for more info '/home/haoyang.feng/mos/work/PhantomFlow/test-results/log/error_1.log'

Some processes exited with errors:

Test name                       Exit code  Passed assertions  Failed assertions  Process time /s
------------------------------  ---------  -----------------  -----------------  ---------------
[flows/responsive.test.js]      1          0 passes           0 fails            0.07s          
[flows/coffeemachine.test.js]   1          0 passes           0 fails            0.067s         

Completed 0 assertions in 0 seconds. 0 assertions failed, 0 assertions passed. 
/home/haoyang.feng/mos/work/PhantomFlow/node_modules/wrench/lib/wrench.js:249
        if (e.code !== 'EEXIST') throw e;
                                 ^

Error: ENOENT: no such file or directory, mkdir '/home/haoyang.feng/mos/work/PhantomFlow/test-results/report'
    at Object.fs.mkdirSync (fs.js:855:18)
    at Object.exports.copyDirSyncRecursive (/home/haoyang.feng/mos/work/PhantomFlow/node_modules/wrench/lib/wrench.js:246:12)
    at copyReportTemplate (/home/haoyang.feng/mos/work/PhantomFlow/phantomflow.js:569:10)
    at /home/haoyang.feng/mos/work/PhantomFlow/phantomflow.js:515:7
    at Timeout.<anonymous> (/home/haoyang.feng/mos/work/PhantomFlow/node_modules/async/lib/async.js:789:30)
    at Timeout._onTimeout (/home/haoyang.feng/mos/work/PhantomFlow/node_modules/async/lib/async.js:167:37)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
jamescryer commented 7 years ago

Works for me on Windows with Node v6.10.0 and v7.7.3. Can you provide more details?

haoyangnz commented 7 years ago

@jamescryer Ubuntu 14.04. node v7.5.0.

bjornicus commented 7 years ago

I'm seeing the same error with those same steps on macOS with node v7.7.1.

bjornicus commented 7 years ago

Here's the output with debug on; I've no idea what's in the error_2.log would tell me because it doesn't actually exist (in fact the test-results directory gets deleted as well if it exists). I tried replacing wrench with fs-extra, which seemed to work a little better, but still no error log.

▶ node test/test.js debug
Parallelising 2 test files on 1 processes.

Picking up job: flows/responsive.test.js

[flows/responsive.test.js] (786ms) Unable to open file: "/Users/bjorn/scratch/PhantomFlow/lib/start.js"

[flows/responsive.test.js] (1ms)   phantomjs://code/bootstrap.js:110 in __die

[flows/responsive.test.js] (0ms) Unable to load script "/Users/bjorn/scratch/PhantomFlow/lib/start.js"; check file syntax

[flows/responsive.test.js] (0ms)   phantomjs://code/bootstrap.js:110 in __die
[flows/responsive.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.
[flows/responsive.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.

 Please take a look at the error log for more info '/Users/bjorn/scratch/PhantomFlow/test-results/log/error_2.log'
Picking up job: flows/coffeemachine.test.js

[flows/coffeemachine.test.js] (776ms) Unable to open file: "/Users/bjorn/scratch/PhantomFlow/lib/start.js"

[flows/coffeemachine.test.js] (0ms)   phantomjs://code/bootstrap.js:110 in __die

[flows/coffeemachine.test.js] (0ms) Unable to load script "/Users/bjorn/scratch/PhantomFlow/lib/start.js"; check file syntax

[flows/coffeemachine.test.js] (0ms)   phantomjs://code/bootstrap.js:110 in __die
[flows/coffeemachine.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.
[flows/coffeemachine.test.js] It broke, sorry. Process aborted. Non-zero code (1) returned.

 Please take a look at the error log for more info '/Users/bjorn/scratch/PhantomFlow/test-results/log/error_1.log'

Some processes exited with errors:

Test name                       Exit code  Passed assertions  Failed assertions  Process time /s
------------------------------  ---------  -----------------  -----------------  ---------------
[flows/responsive.test.js]      1          0 passes           0 fails            4.942s
[flows/coffeemachine.test.js]   1          0 passes           0 fails            4.872s

Completed 0 assertions in 10 seconds. 0 assertions failed, 0 assertions passed.
/Users/bjorn/scratch/PhantomFlow/node_modules/wrench/lib/wrench.js:249
        if (e.code !== 'EEXIST') throw e;
                                 ^

Error: ENOENT: no such file or directory, mkdir '/Users/bjorn/scratch/PhantomFlow/test-results/report'
    at Object.fs.mkdirSync (fs.js:894:18)
    at Object.exports.copyDirSyncRecursive (/Users/bjorn/scratch/PhantomFlow/node_modules/wrench/lib/wrench.js:246:12)
    at copyReportTemplate (/Users/bjorn/scratch/PhantomFlow/phantomflow.js:569:10)
    at /Users/bjorn/scratch/PhantomFlow/phantomflow.js:515:7
    at Timeout.<anonymous> (/Users/bjorn/scratch/PhantomFlow/node_modules/async/lib/async.js:789:30)
    at Timeout._onTimeout (/Users/bjorn/scratch/PhantomFlow/node_modules/async/lib/async.js:167:37)
    at ontimeout (timers.js:380:14)
    at tryOnTimeout (timers.js:244:5)
    at Timer.listOnTimeout (timers.js:214:5)
jamescryer commented 7 years ago

I'd appreciate it if someone else can look into fixing this and create a PR. Might not be able to look myself anytime soon.

meltuhamy commented 7 years ago

Looks like the problem happens because we are using mkdir to create a folder that doesnt exist. It's unclear if this problem has always existed in Linux, but maybe the solution is to use a recursvie mkdir function as mentioned here http://stackoverflow.com/questions/31552451/how-do-i-use-fs-to-make-a-folder-automatically