Medium / phantomjs

NPM wrapper for installing phantomjs
Other
1.42k stars 436 forks source link

PhantomJS-prebuilt encounters TypeError due to FileConstructor #693

Closed blackholegalaxy closed 7 years ago

blackholegalaxy commented 7 years ago

On an Angular project, we use Karma, Karma-Phantom-launcher which itself uses phantom-js prebuilt, v2.1.14.

As soon as we launch our tests, PhantomJS fails to load:

PhantomJS ERROR TypeError: FileConstructor is not a constructor (evaluating 'new File(arrayOfBlob, "Mock.zip")') at webpack:///src/app/file.component.spec.ts:83:4 <- src/test.ts:44676

Is PhantomJS supporting new File() ?

Here is our full code:

let content = "Hello Mock";
let data = new Blob([content], { type: 'application/zip' });
let arrayOfBlob = new Array<Blob>();
arrayOfBlob.push(data);
let file = new File(arrayOfBlob, "Mock.zip");
blackholegalaxy commented 7 years ago

Using Blob directly and casting it into works. Will do the job until File API fix from PhantomJS