karma-chrome-launcher icon indicating copy to clipboard operation
karma-chrome-launcher copied to clipboard

Utilizing Filesystem API

Open summera opened this issue 9 years ago • 2 comments

Having a bit of trouble getting the filesystem api to work with the chrome launcher. Any suggestions for configuring this? Thanks!

summera avatar Jan 19 '15 18:01 summera

Could you describe the issue you are having in a little more detail please?

dignifiedquire avatar May 18 '15 19:05 dignifiedquire

@Dignifiedquire sure thing.

I was attempting to test a package I wrote, which is a thin wrapper around chrome's filesystem api. I was writing some tests for the library which would write directories and files to chrome's persistent file storage and check if they were there. I tried using karma-chrome-launcher for this, but it didn't seem to get along with the filesystem api.

Test looks something like the following:

describe("Chromestore", function() {
  'use strict';

  var cs = null;

  before(function() {
    cs = new ChromeStore([
      { path: 'videos/clips' },
      { path: 'audio/wav' }
    ]);

    cs.init(1024*1024*1024, function() {
      done();
    });
  });

  it('returns the correct used and remaining bytes', function() {
    cs.usedAndRemaining(function(used, remaining) {
      expect(used).to.equal(0);
      expect(remaining).to.equal(1024*1024*1024);
      done();
    });
  });
});

I also tried configuring karma-chrome-launcher like so:

module.exports = function (config) {
  config.set({
    basePath: '',

    frameworks: ['mocha', 'chai'],

    files: [
      'src/*.js',
      'test/*.spec.js'
    ],

    reporters: ['progress'],

    port: 9876,
    colors: true,
    autoWatch: false,
    singleRun: true,

    logLevel: config.LOG_DEBUG,

    browsers: ['chrome_without_security'],

    customLaunchers: {
      chrome_without_security: {
        base: 'Chrome',
        flags: ['--disable-web-security']
      }
    }
  });
};

It's been a while since I've thought about this so hope this provides you enough information.

summera avatar May 19 '15 14:05 summera