Skip to content

Commit

Permalink
Merge pull request #33 from NotNinja/develop
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
neocotic authored Feb 5, 2018
2 parents 13b6f39 + e2ee5a0 commit 6a2a023
Show file tree
Hide file tree
Showing 55 changed files with 177 additions and 154 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
packages/*/bin/
packages/*/node_modules/
2 changes: 0 additions & 2 deletions .npmignore

This file was deleted.

3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dist: trusty
language: node_js
node_js:
- "8"
- "9"
before_install:
- echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
- sudo apt-get -qq update
Expand All @@ -14,7 +15,9 @@ install:
script:
- npm test
notifications:
email: false
slack:
rooms:
- secure: sXYAo0YqAkdu4ZC0hnmnt0qpuZP7cOFtXf8MZA4a8CSJ/DyzzERF8B4lihEmHMXqXoDmHIMGOUGwQQ6SbG4kSRGWIJGGMiPC8yHhPbkbVBECnb2NxRc72KY7pD7Q2fYpieCGXBwh3ZukDPcUhFoiEddMdAKX1yTZsxYBR6xrIPUf3xGXq4e/T72bmxGono1NmUFD499uCdtPc6vYqQkXAo0vt79yGKaEMtCUoUeJcq6cPWaCzE9beMkKDb8XVjhLlJrJMXAqxuH3aIlKhGCgtwJfReomUNXRbmZGujTM4qi8yqi4f51F6jHp+1PiQbpcPW5bcGOOFlPcrtw6NVl1gcWe4Vz7hxBBeTq3Ut2B/pTLvkr91ow4tYy1g6sIS+R7cqPQNJ8MJsAtyydM3345yhj00EbxtiXxN/4by7GNMDJvWqQMIlhpBL+GA95ikh9rdOmafVjyUOSbGun048RHSdZav+rMGyQBLA9ncDAvTcPkJwDpkh/Ri2vRs41/SXHcdB/lOQfIeWLtZbSB63VtjlmCgxaPnr8ErglqBUEEBvK2/SyJshdCV94l+43v2eog0K8gN+5JkhwzNCY7hJjQOxpAqeghVPCr00QBw4HJcjb6A8b5LIKbgpIRHd6X9gD/NBJQuMTSPq+KIFQ8IgQjRr4+PyeXmvBH8OSzma8R9Uc=
on_failure: change
on_success: change
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Version 0.4.0, 2018.02.05

* Bump Puppeteer to v1 [#32](https://github.com/NotNinja/convert-svg/issues/32)
* Replace chai with assert [#34](https://github.com/NotNinja/convert-svg/issues/34)

## Version 0.3.3, 2017.12.08

* Add puppeteer.launch options available into CLI [#29](https://github.com/NotNinja/convert-svg/issues/29)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2017 Alasdair Mercer, !ninja
Copyright (C) 2018 Alasdair Mercer, !ninja

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.5.1",
"version": "0.3.3",
"version": "0.4.0",
"packages": [
"packages/*"
],
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "convert-svg",
"license": "MIT",
"devDependencies": {
"eslint": "^4.13.0",
"eslint": "^4.17.0",
"eslint-config-notninja": "^0.2.3",
"lerna": "^2.5.1",
"mocha": "^4.0.1"
"lerna": "^2.8.0",
"mocha": "^5.0.0"
},
"scripts": {
"bootstrap": "lerna bootstrap",
Expand Down
1 change: 0 additions & 1 deletion packages/convert-svg-core/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
test/
.*
*.md
12 changes: 5 additions & 7 deletions packages/convert-svg-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "convert-svg-core",
"version": "0.3.3",
"version": "0.4.0",
"description": "Supports converting SVG into another format using headless Chromium",
"homepage": "https://github.com/NotNinja/convert-svg",
"bugs": {
Expand All @@ -26,21 +26,19 @@
},
"dependencies": {
"chalk": "^2.3.0",
"commander": "^2.12.0",
"commander": "^2.13.0",
"file-url": "^2.0.2",
"get-stdin": "^5.0.1",
"glob": "^7.1.2",
"lodash.omit": "^4.5.0",
"lodash.pick": "^4.4.0",
"pollock": "^0.1.0",
"puppeteer": "^0.13.0",
"puppeteer": "^1.0.0",
"tmp": "0.0.33"
},
"devDependencies": {
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"mocha": "^4.0.1",
"sinon": "^4.1.3"
"mocha": "^5.0.0",
"sinon": "^4.2.2"
},
"main": "src/index.js",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/convert-svg-core/src/API.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion packages/convert-svg-core/src/CLI.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion packages/convert-svg-core/src/Converter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion packages/convert-svg-core/src/Provider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion packages/convert-svg-core/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 0 additions & 3 deletions packages/convert-svg-core/test/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
"extends": "../../../.eslintrc.json",
"env": {
"mocha": true
},
"rules": {
"no-unused-expressions": "off"
}
}
18 changes: 10 additions & 8 deletions packages/convert-svg-core/test/API.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,7 +22,7 @@

'use strict';

const { expect } = require('chai');
const assert = require('assert');
const sinon = require('sinon');

const API = require('../src/API');
Expand Down Expand Up @@ -50,26 +50,28 @@ describe('[convert-svg-core] API', () => {
it('should return Converter instance using provider', () => {
const converter = api.createConverter();

expect(converter).to.be.an.instanceOf(Converter);
expect(converter.provider).to.equal(provider);
assert.ok(converter instanceof Converter);
assert.strictEqual(converter.provider, provider);
});

it('should never return same instance', () => {
expect(api.createConverter()).to.not.equal(api.createConverter());
assert.notStrictEqual(api.createConverter(), api.createConverter());
});
});

describe('#provider', () => {
it('should return provider', () => {
expect(api.provider).to.equal(provider);
assert.strictEqual(api.provider, provider);
});
});

describe('#version', () => {
it('should return provider version', () => {
provider.getVersion.returns('0.0.0');
const version = '0.0.0';

expect(api.version).to.equal('0.0.0');
provider.getVersion.returns(version);

assert.equal(api.version, version);
});
});
});
22 changes: 13 additions & 9 deletions packages/convert-svg-core/test/CLI.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,7 +22,7 @@

'use strict';

const { expect } = require('chai');
const assert = require('assert');
const { EOL } = require('os');
const sinon = require('sinon');
const { Writable } = require('stream');
Expand Down Expand Up @@ -54,19 +54,23 @@ describe('[convert-svg-core] CLI', () => {
it('should write message to error stream', () => {
cli.error('foo');

expect(outputStream.write.callCount).to.equal(0);
expect(errorStream.write.callCount).to.equal(1);
expect(errorStream.write.args[0]).to.deep.equal([ `foo${EOL}` ]);
assert.equal(outputStream.write.callCount, 0);
assert.equal(errorStream.write.callCount, 1);
assert.deepEqual(errorStream.write.args, [
[ `foo${EOL}` ]
]);
});
});

describe('#output', () => {
it('should write message to output stream', () => {
cli.output('foo');

expect(errorStream.write.callCount).to.equal(0);
expect(outputStream.write.callCount).to.equal(1);
expect(outputStream.write.args[0]).to.deep.equal([ `foo${EOL}` ]);
assert.equal(errorStream.write.callCount, 0);
assert.equal(outputStream.write.callCount, 1);
assert.deepEqual(outputStream.write.args, [
[ `foo${EOL}` ]
]);
});
});

Expand All @@ -76,7 +80,7 @@ describe('[convert-svg-core] CLI', () => {

describe('#provider', () => {
it('should return provider', () => {
expect(cli.provider).to.equal(provider);
assert.strictEqual(cli.provider, provider);
});
});
});
37 changes: 21 additions & 16 deletions packages/convert-svg-core/test/Converter.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,17 +22,12 @@

'use strict';

const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const assert = require('assert');
const sinon = require('sinon');

const Converter = require('../src/Converter');
const Provider = require('../src/Provider');

chai.use(chaiAsPromised);

const { expect } = chai;

describe('[convert-svg-core] Converter', () => {
let converter;
let provider;
Expand All @@ -53,8 +48,13 @@ describe('[convert-svg-core] Converter', () => {
it('should thrown an error', async() => {
await converter.destroy();

await expect(converter.convert('<svg></svg>')).to.eventually.be.rejectedWith(Error,
'Converter has been destroyed. A new Converter must be created');
try {
await converter.convert('<svg></svg>');
// Should have thrown
assert.fail();
} catch (e) {
assert.equal(e.message, 'Converter has been destroyed. A new Converter must be created');
}
});
});
});
Expand All @@ -66,35 +66,40 @@ describe('[convert-svg-core] Converter', () => {
it('should thrown an error', async() => {
await converter.destroy();

await expect(converter.convertFile('foo.svg')).to.eventually.be.rejectedWith(Error,
'Converter has been destroyed. A new Converter must be created');
try {
await converter.convertFile('foo.svg');
// Should have thrown
assert.fail();
} catch (e) {
assert.equal(e.message, 'Converter has been destroyed. A new Converter must be created');
}
});
});
});

describe('#destroy', () => {
it('should destroy the converter', async() => {
expect(converter.destroyed).to.equal(false);
assert.equal(converter.destroyed, false);

await converter.destroy();

expect(converter.destroyed).to.equal(true);
assert.equal(converter.destroyed, true);
});
});

describe('#destroyed', () => {
it('should indicate whether converter has been destroyed', async() => {
expect(converter.destroyed).to.equal(false);
assert.equal(converter.destroyed, false);

await converter.destroy();

expect(converter.destroyed).to.equal(true);
assert.equal(converter.destroyed, true);
});
});

describe('#provider', () => {
it('should return provider', () => {
expect(converter.provider).to.equal(provider);
assert.strictEqual(converter.provider, provider);
});
});
});
16 changes: 10 additions & 6 deletions packages/convert-svg-core/test/Provider.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Alasdair Mercer, !ninja
* Copyright (C) 2018 Alasdair Mercer, !ninja
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,7 +22,7 @@

'use strict';

const { expect } = require('chai');
const assert = require('assert');

const Provider = require('../src/Provider');

Expand Down Expand Up @@ -53,8 +53,12 @@ describe('[convert-svg-core] Provider', () => {
it('should throw an error by default', () => {
const provider = new Provider();

expect(() => provider[methodName]()).to.throw(Error,
`Provider#${methodName} abstract method is not implemented`);
assert.throws(() => {
provider[methodName]();
}, (error) => {
return error instanceof Error &&
error.message === `Provider#${methodName} abstract method is not implemented`;
});
});
});
});
Expand All @@ -63,15 +67,15 @@ describe('[convert-svg-core] Provider', () => {
it('should return Provider#getType transformed into lower case by default', () => {
const provider = new TestProviderImpl();

expect(provider.getExtension()).to.equal('type');
assert.equal(provider.getExtension(), 'type');
});
});

describe('#getFormat', () => {
it('should return Provider#getType transformed into upper case by default', () => {
const provider = new TestProviderImpl();

expect(provider.getFormat()).to.equal('TYPE');
assert.equal(provider.getFormat(), 'TYPE');
});
});
});
Loading

0 comments on commit 6a2a023

Please sign in to comment.