Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Fix #198
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan.Orlov committed Feb 17, 2017
1 parent 609dd1c commit 0b48036
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/BundleSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ export class BundleSource {
* @memberOf BundleSource
*/
public addFile(file: File) {
if (file.info.isRemoteFile || file.notFound || file.collection.acceptFiles === false) {
if (file.info.isRemoteFile || file.notFound
|| file.collection && file.collection.acceptFiles === false) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/shims/helloFirstShim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global.helloFirstShim = { result: "I am helloFirstShim and i am shimmed!" }
54 changes: 54 additions & 0 deletions test/shimming.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const should = require('should');
const fsbx = require(`../dist/commonjs/index.js`);
const path = require("path");
const { getTestEnv, createEnv } = require("./fixtures/lib.js")
const fs = require("fs");
const mkdirp = require("mkdirp");

describe('Shimmin', () => {


it("File shim should work", (done) => {
createEnv({
project: {
shim: {
myTestShim: {
source: "test/fixtures/shims/helloFirstShim.js",
exports: "global.helloFirstShim"
}
},
files: {
"index.ts": `exports.hello = { bar : require("myTestShim") }`
},
instructions: "> index.ts"
}
}).then((result) => {
result.project.FuseBox.import("./index")
.should.deepEqual({ hello: { bar: { result: 'I am helloFirstShim and i am shimmed!' } } })
done();
})
});

it("Reference shim should work", (done) => {
global.testReferenceShim = { result: "I am okay" };
createEnv({
project: {
shim: {
myTestShim: {
exports: "global.testReferenceShim"
}
},
files: {
"index.ts": `exports.hello = { bar : require("myTestShim") }`
},
instructions: "> index.ts"
}
}).then((result) => {
result.project.FuseBox.import("./index")
.should.deepEqual({ hello: { bar: { result: 'I am okay' } } })
delete global.testReferenceShim;
done();
})
});

});

0 comments on commit 0b48036

Please sign in to comment.