Update package.json + tests/ to support browser property for bundlers, delete old useless tests for AMD

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2018-06-28 19:26:08 -04:00 committed by David Humphrey
parent c15145cc03
commit 65bbc17ccb
70 changed files with 37 additions and 127 deletions

6
package-lock.json generated
View File

@ -13084,6 +13084,12 @@
"resolve-from": "1.0.1" "resolve-from": "1.0.1"
} }
}, },
"requirejs": {
"version": "2.3.5",
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.5.tgz",
"integrity": "sha512-svnO+aNcR/an9Dpi44C7KSAy5fFGLtmPbaaCeQaklUz8BQhS64tWWIIlvEA5jrWICzlO/X9KSzSeXFnZdBu8nw==",
"dev": true
},
"resolve": { "resolve": {
"version": "1.8.1", "version": "1.8.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",

View File

@ -34,7 +34,9 @@
"chai": "^4.1.2", "chai": "^4.1.2",
"eslint": "^5.0.1", "eslint": "^5.0.1",
"mocha": "^5.2.0", "mocha": "^5.2.0",
"parcel-bundler": "^1.9.3" "parcel-bundler": "^1.9.3",
"requirejs": "^2.3.5"
}, },
"main": "./src/index.js" "main": "./src/index.js",
"browser": "./dist/filer.min.js"
} }

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,44 +0,0 @@
/**
* https://github.com/js-platform/filer/pull/225
*
* NOTE: this test has to be run outside the browserify step,
* since combinining require for node.js/browserify builds with
* r.js doesn't work.
*/
var requirejs = require('requirejs');
var expect = require('chai').expect;
// browser-request assumes access to XHR
GLOBAL.XMLHttpRequest = {};
describe('require.js should be able to use built Filer, issue 225', function() {
it('should properly load Filer as an AMD module, with Buffer included', function(done) {
requirejs.config({
baseUrl: __dirname,
paths: {
"filer": "../../dist/filer-issue225"
},
nodeRequire: require
});
requirejs(["filer"], function(Filer) {
expect(Filer).to.exist;
expect(Filer.Buffer).to.exist;
var fs = new Filer.FileSystem({provider: new Filer.FileSystem.providers.Memory()});
var buf = new Filer.Buffer([1, 2, 3]);
fs.writeFile('/file', buf, function(err) {
expect(err).not.to.exist;
fs.readFile('/file', function(err, data) {
expect(err).not.to.exist;
expect(data).to.deep.equal(buf);
done();
});
});
});
});
});

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,5 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;
var setImmediate = require('../../lib/async.js').setImmediate; var setImmediate = require('../../lib/async.js').setImmediate;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Path = require('../..').Path; var Path = require('../../src').Path;
var expect = require('chai').expect; var expect = require('chai').expect;
describe('Path.resolve does not work, issue357', function() { describe('Path.resolve does not work, issue357', function() {

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;
var async = require('../../lib/async.js'); var async = require('../../lib/async.js');

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -11,6 +11,7 @@
<script src="../node_modules/chai/chai.js"></script> <script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/mocha/mocha.js"></script> <script src="../node_modules/mocha/mocha.js"></script>
<script> <script>
mocha.setup('bdd').timeout(5000).slow(250);; mocha.setup('bdd').timeout(5000).slow(250);;
@ -19,7 +20,8 @@
mocha.run(); mocha.run();
}; };
</script> </script>
<script src="./index.js"></script>
<!-- Add any new tests to `tests/index.js` -->
<script src="./index.js"></script>
</body> </body>
</html> </html>

View File

@ -66,7 +66,6 @@ require("./spec/node-js/simple/test-fs-watch");
require("./spec/node-js/simple/test-fs-watch-recursive"); require("./spec/node-js/simple/test-fs-watch-recursive");
// Regressions, Bugs // Regressions, Bugs
// NOTE: bugs/issue225.js has to be run outside this step, see gruntfile.js
require("./bugs/issue105"); require("./bugs/issue105");
require("./bugs/issue106"); require("./bugs/issue106");
require("./bugs/issue239"); require("./bugs/issue239");

View File

@ -1,4 +1,4 @@
var Filer = require("../.."); var Filer = require('../../src');
var indexedDB = global.indexedDB || var indexedDB = global.indexedDB ||
global.mozIndexedDB || global.mozIndexedDB ||

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
function MemoryTestProvider(name) { function MemoryTestProvider(name) {
var that = this; var that = this;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var IndexedDBTestProvider = require('./indexeddb.js'); var IndexedDBTestProvider = require('./indexeddb.js');
var WebSQLTestProvider = require('./websql.js'); var WebSQLTestProvider = require('./websql.js');
var MemoryTestProvider = require('./memory.js'); var MemoryTestProvider = require('./memory.js');

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var needsCleanup = []; var needsCleanup = [];
if(global.addEventListener) { if(global.addEventListener) {

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var expect = require('chai').expect; var expect = require('chai').expect;
describe("Filer.Errors", function() { describe("Filer.Errors", function() {

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var expect = require('chai').expect; var expect = require('chai').expect;
describe("Filer", function() { describe("Filer", function() {

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;
var constants = require('../../src/constants.js'); var constants = require('../../src/constants.js');

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,5 +1,4 @@
var Filer = require('../..'); var Path = require('../../src').Path;
var Path = Filer.Path;
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,13 +0,0 @@
define(["Filer", "util"], function(Filer, util) {
describe('Nodejs compatability', function() {
beforeEach(util.setup);
afterEach(util.cleanup);
it('module should be requireable', function() {
expect(function() {
var Filer = require('../../dist/filer_node.js');
}).to.not.throwError;
});
});
});

View File

@ -1,4 +1,3 @@
var Filer = require('../../../..');
var util = require('../../../lib/test-utils.js'); var util = require('../../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../../..');
var util = require('../../../lib/test-utils.js'); var util = require('../../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../../..');
var util = require('../../../lib/test-utils.js'); var util = require('../../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../../..');
var util = require('../../../lib/test-utils.js'); var util = require('../../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Buffer = require('../../..').Buffer; var Buffer = require('../../../src').Buffer;
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../../..'); var Filer = require('../../../src');
var expect = require('chai').expect; var expect = require('chai').expect;
describe("Filer.FileSystem.providers", function() { describe("Filer.FileSystem.providers", function() {

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,3 @@
var Filer = require('../../..');
var util = require('../../lib/test-utils.js'); var util = require('../../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Filer = require('../..'); var Filer = require('../../src');
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;

View File

@ -1,4 +1,4 @@
var Path = require('../..').Path; var Path = require('../../src').Path;
var expect = require('chai').expect; var expect = require('chai').expect;
describe('Path.normalize and trailing slashes', function() { describe('Path.normalize and trailing slashes', function() {