Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cmd/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ function defaultPackageCreator(
filter: (...args) => fileFilter.wantFile(...args),
})
.then((buffer) => {
let extension = 'zip';
let packageName = safeFileName(
`${manifestData.name}-${manifestData.version}.xpi`);
`${manifestData.name}-${manifestData.version}.${extension}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well just make this ${manifestData.name}-${manifestData.version}.zip -- no need for a variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let extensionPath = path.join(artifactsDir, packageName);
let stream = createWriteStream(extensionPath);
let promisedStream = streamToPromise(stream);
Expand Down
12 changes: 6 additions & 6 deletions tests/test-cmd/test.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('build', () => {
})
.then((buildResult) => {
assert.match(buildResult.extensionPath,
/minimal_extension-1\.0\.xpi$/);
/minimal_extension-1\.0\.zip$/);
return buildResult.extensionPath;
})
.then((extensionPath) => zipFile.open(extensionPath))
Expand Down Expand Up @@ -62,12 +62,12 @@ describe('build', () => {
})
.then((buildResult) => {
assert.match(buildResult.extensionPath,
/the_extension-0\.0\.1\.xpi$/);
/the_extension-0\.0\.1\.zip$/);
return buildResult.extensionPath;
})
));

it('asks FileFilter what files to include in the XPI', () => {
it('asks FileFilter what files to include in the ZIP', () => {
let zipFile = new ZipFile();
let fileFilter = new FileFilter({
filesToIgnore: ['**/background-script.js'],
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('build', () => {
{manifestData: basicManifest, onSourceChange, fileFilter})
.then((buildResult) => {
// Make sure we still have a build result.
assert.match(buildResult.extensionPath, /\.xpi$/);
assert.match(buildResult.extensionPath, /\.zip$/);
return buildResult;
})
.then((buildResult) => {
Expand All @@ -122,7 +122,7 @@ describe('build', () => {
.then(() => args.onChange());
})
.then((buildResult) => {
assert.match(buildResult.extensionPath, /\.xpi$/);
assert.match(buildResult.extensionPath, /\.zip$/);
return fs.stat(buildResult.extensionPath);
})
.then((stat) => {
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('build', () => {
assert.equal(filter.wantFile('some.xpi'), true);
assert.equal(filter.wantFile('manifest.json'), false);
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh. I fixed the eslint rule for this in another PR that hasn't landed yet. I was like wut, how did that even get committed? 🎯

Copy link
Contributor Author

@tofumatt tofumatt Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And my editor just deletes trailing whitespace so I didn't even notice I committed it 😄

Should I remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, your change is correct. Thanks.

it('ignores node_modules by default', () => {
assert.equal(defaultFilter.wantFile('path/to/node_modules'), false);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cmd/test.sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('sign', () => {
// Do a sanity check that a built extension was passed to the
// signer.
assert.include(stubs.signAddon.firstCall.args[0].xpiPath,
'minimal_extension-1.0.xpi');
'minimal_extension-1.0.zip');
});
}
));
Expand Down
8 changes: 4 additions & 4 deletions tests/test-firefox/test.firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe('firefox', () => {
return withTempDir(
(tmpDir) => {
let data = {
extensionPath: fixturePath('minimal_extension-1.0.xpi'),
extensionPath: fixturePath('minimal_extension-1.0.zip'),
profile: undefined,
profileDir: path.join(tmpDir.path(), 'profile'),
};
Expand Down Expand Up @@ -411,19 +411,19 @@ describe('firefox', () => {

it('requires a directory path for proxy installs', () => setUp(
(data) => {
const xpiPath = fixturePath('minimal_extension-1.0.xpi');
const extensionPath = fixturePath('minimal_extension-1.0.zip');
return firefox.installExtension(
{
manifestData: basicManifest,
profile: data.profile,
extensionPath: xpiPath,
extensionPath: extensionPath,
asProxy: true,
})
.then(makeSureItFails())
.catch(onlyInstancesOf(WebExtError, (error) => {
assert.match(error.message,
/must be the extension source directory/);
assert.include(error.message, xpiPath);
assert.include(error.message, extensionPath);
}));
}
));
Expand Down