diff --git a/.eslintignore b/.eslintignore
index 3718fde..cae6b89 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,2 +1 @@
-packages/*/bin/
packages/*/node_modules/
diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index 19bb1e1..0000000
--- a/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.*
-*.md
diff --git a/.travis.yml b/.travis.yml
index f2fe796..5ff2e87 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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
@@ -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
diff --git a/CHANGES.md b/CHANGES.md
index 596fa21..f89a9b3 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -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)
diff --git a/LICENSE.md b/LICENSE.md
index 6cc536a..989f1e4 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -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
diff --git a/lerna.json b/lerna.json
index 60c01fd..b6d170f 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,6 +1,6 @@
{
"lerna": "2.5.1",
- "version": "0.3.3",
+ "version": "0.4.0",
"packages": [
"packages/*"
],
diff --git a/package.json b/package.json
index 3d79f5a..6bb448e 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/packages/convert-svg-core/.npmignore b/packages/convert-svg-core/.npmignore
index 05d93bf..d702422 100644
--- a/packages/convert-svg-core/.npmignore
+++ b/packages/convert-svg-core/.npmignore
@@ -1,3 +1,2 @@
test/
.*
-*.md
diff --git a/packages/convert-svg-core/package.json b/packages/convert-svg-core/package.json
index b136834..3d62c22 100644
--- a/packages/convert-svg-core/package.json
+++ b/packages/convert-svg-core/package.json
@@ -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": {
@@ -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": {
diff --git a/packages/convert-svg-core/src/API.js b/packages/convert-svg-core/src/API.js
index ae52038..f1385a6 100644
--- a/packages/convert-svg-core/src/API.js
+++ b/packages/convert-svg-core/src/API.js
@@ -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
diff --git a/packages/convert-svg-core/src/CLI.js b/packages/convert-svg-core/src/CLI.js
index 914f140..015a7db 100644
--- a/packages/convert-svg-core/src/CLI.js
+++ b/packages/convert-svg-core/src/CLI.js
@@ -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
diff --git a/packages/convert-svg-core/src/Converter.js b/packages/convert-svg-core/src/Converter.js
index c462837..702d6c8 100644
--- a/packages/convert-svg-core/src/Converter.js
+++ b/packages/convert-svg-core/src/Converter.js
@@ -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
diff --git a/packages/convert-svg-core/src/Provider.js b/packages/convert-svg-core/src/Provider.js
index 8aca574..246f91e 100644
--- a/packages/convert-svg-core/src/Provider.js
+++ b/packages/convert-svg-core/src/Provider.js
@@ -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
diff --git a/packages/convert-svg-core/src/index.js b/packages/convert-svg-core/src/index.js
index 6b3cfae..dd28e76 100644
--- a/packages/convert-svg-core/src/index.js
+++ b/packages/convert-svg-core/src/index.js
@@ -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
diff --git a/packages/convert-svg-core/test/.eslintrc.json b/packages/convert-svg-core/test/.eslintrc.json
index bc9fb97..c37ad2e 100644
--- a/packages/convert-svg-core/test/.eslintrc.json
+++ b/packages/convert-svg-core/test/.eslintrc.json
@@ -2,8 +2,5 @@
"extends": "../../../.eslintrc.json",
"env": {
"mocha": true
- },
- "rules": {
- "no-unused-expressions": "off"
}
}
diff --git a/packages/convert-svg-core/test/API.spec.js b/packages/convert-svg-core/test/API.spec.js
index f7b238a..fdfc84d 100644
--- a/packages/convert-svg-core/test/API.spec.js
+++ b/packages/convert-svg-core/test/API.spec.js
@@ -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
@@ -22,7 +22,7 @@
'use strict';
-const { expect } = require('chai');
+const assert = require('assert');
const sinon = require('sinon');
const API = require('../src/API');
@@ -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);
});
});
});
diff --git a/packages/convert-svg-core/test/CLI.spec.js b/packages/convert-svg-core/test/CLI.spec.js
index df2f315..e2cdf5e 100644
--- a/packages/convert-svg-core/test/CLI.spec.js
+++ b/packages/convert-svg-core/test/CLI.spec.js
@@ -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
@@ -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');
@@ -54,9 +54,11 @@ 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}` ]
+ ]);
});
});
@@ -64,9 +66,11 @@ describe('[convert-svg-core] CLI', () => {
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}` ]
+ ]);
});
});
@@ -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);
});
});
});
diff --git a/packages/convert-svg-core/test/Converter.spec.js b/packages/convert-svg-core/test/Converter.spec.js
index f94e5cf..e4a01f3 100644
--- a/packages/convert-svg-core/test/Converter.spec.js
+++ b/packages/convert-svg-core/test/Converter.spec.js
@@ -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
@@ -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;
@@ -53,8 +48,13 @@ describe('[convert-svg-core] Converter', () => {
it('should thrown an error', async() => {
await converter.destroy();
- await expect(converter.convert('')).to.eventually.be.rejectedWith(Error,
- 'Converter has been destroyed. A new Converter must be created');
+ try {
+ await converter.convert('');
+ // Should have thrown
+ assert.fail();
+ } catch (e) {
+ assert.equal(e.message, 'Converter has been destroyed. A new Converter must be created');
+ }
});
});
});
@@ -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);
});
});
});
diff --git a/packages/convert-svg-core/test/Provider.spec.js b/packages/convert-svg-core/test/Provider.spec.js
index fb1e3c7..09d7380 100644
--- a/packages/convert-svg-core/test/Provider.spec.js
+++ b/packages/convert-svg-core/test/Provider.spec.js
@@ -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
@@ -22,7 +22,7 @@
'use strict';
-const { expect } = require('chai');
+const assert = require('assert');
const Provider = require('../src/Provider');
@@ -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`;
+ });
});
});
});
@@ -63,7 +67,7 @@ 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');
});
});
@@ -71,7 +75,7 @@ describe('[convert-svg-core] Provider', () => {
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');
});
});
});
diff --git a/packages/convert-svg-core/test/index.spec.js b/packages/convert-svg-core/test/index.spec.js
index 81f2b61..0a15ef5 100644
--- a/packages/convert-svg-core/test/index.spec.js
+++ b/packages/convert-svg-core/test/index.spec.js
@@ -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
@@ -22,7 +22,7 @@
'use strict';
-const { expect } = require('chai');
+const assert = require('assert');
const API = require('../src/API');
const CLI = require('../src/CLI');
@@ -33,25 +33,25 @@ const Provider = require('../src/Provider');
describe('[convert-svg-core] index', () => {
describe('.API', () => {
it('should be a reference to API constructor', () => {
- expect(index.API).to.equal(API, 'Must be API constructor');
+ assert.strictEqual(index.API, API, 'Must be API constructor');
});
});
describe('.CLI', () => {
it('should be a reference to CLI constructor', () => {
- expect(index.CLI).to.equal(CLI, 'Must be CLI constructor');
+ assert.strictEqual(index.CLI, CLI, 'Must be CLI constructor');
});
});
describe('.Converter', () => {
it('should be a reference to Converter constructor', () => {
- expect(index.Converter).to.equal(Converter, 'Must be Converter constructor');
+ assert.strictEqual(index.Converter, Converter, 'Must be Converter constructor');
});
});
describe('.Provider', () => {
it('should be a reference to Provider constructor', () => {
- expect(index.Provider).to.equal(Provider, 'Must be Provider constructor');
+ assert.strictEqual(index.Provider, Provider, 'Must be Provider constructor');
});
});
});
diff --git a/packages/convert-svg-test-helper/.eslintrc.json b/packages/convert-svg-test-helper/.eslintrc.json
index 100aa8d..19bc906 100644
--- a/packages/convert-svg-test-helper/.eslintrc.json
+++ b/packages/convert-svg-test-helper/.eslintrc.json
@@ -2,8 +2,5 @@
"extends": "../../.eslintrc.json",
"env": {
"mocha": true
- },
- "rules": {
- "no-unused-expressions": "off"
}
}
diff --git a/packages/convert-svg-test-helper/.npmignore b/packages/convert-svg-test-helper/.npmignore
index 19bb1e1..d702422 100644
--- a/packages/convert-svg-test-helper/.npmignore
+++ b/packages/convert-svg-test-helper/.npmignore
@@ -1,2 +1,2 @@
+test/
.*
-*.md
diff --git a/packages/convert-svg-test-helper/package.json b/packages/convert-svg-test-helper/package.json
index 80beff9..5480405 100644
--- a/packages/convert-svg-test-helper/package.json
+++ b/packages/convert-svg-test-helper/package.json
@@ -1,6 +1,6 @@
{
"name": "convert-svg-test-helper",
- "version": "0.3.3",
+ "version": "0.4.0",
"description": "Helper for testing convert-svg-core implementations",
"homepage": "https://github.com/NotNinja/convert-svg",
"bugs": {
@@ -27,13 +27,11 @@
"url": "https://github.com/NotNinja/convert-svg.git"
},
"dependencies": {
- "chai": "^4.1.2",
- "chai-as-promised": "^7.1.1",
"file-url": "^2.0.2",
"lodash.clonedeep": "^4.5.0",
- "mocha": "^4.0.1",
+ "mocha": "^5.0.0",
"rimraf": "^2.6.2",
- "sinon": "^4.1.3"
+ "sinon": "^4.2.2"
},
"main": "src/index.js",
"engines": {
diff --git a/packages/convert-svg-test-helper/src/Helper.js b/packages/convert-svg-test-helper/src/Helper.js
index f815282..88234ef 100644
--- a/packages/convert-svg-test-helper/src/Helper.js
+++ b/packages/convert-svg-test-helper/src/Helper.js
@@ -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
@@ -22,8 +22,7 @@
'use strict';
-const chai = require('chai');
-const chaiAsPromised = require('chai-as-promised');
+const assert = require('assert');
const cloneDeep = require('lodash.clonedeep');
const fileUrl = require('file-url');
const fs = require('fs');
@@ -34,9 +33,6 @@ const util = require('util');
const coreTests = require('./tests.json');
-chai.use(chaiAsPromised);
-
-const { expect } = chai;
const makeDirectory = util.promisify(fs.mkdir);
const readFile = util.promisify(fs.readFile);
const removeFile = util.promisify(rimraf);
@@ -167,9 +163,11 @@ class Helper {
});
afterEach(() => {
- expect(api.createConverter.callCount).to.equal(1);
- expect(converter.destroy.callCount).to.equal(1);
+ assert.equal(api.createConverter.callCount, 1);
+ assert.equal(converter.destroy.callCount, 1);
+ });
+ afterEach(() => {
api.createConverter.restore();
});
} else {
@@ -212,13 +210,19 @@ class Helper {
const method = testAPI ? api.convertFile.bind(api) : converter.convertFile.bind(converter);
if (test.error) {
- await expect(method(inputFilePath, options)).to.eventually.be.rejectedWith(Error, test.error);
+ try {
+ await method(inputFilePath, options);
+ // Should have thrown
+ assert.fail();
+ } catch (e) {
+ assert.equal(e.message, test.error);
+ }
} else {
const actualFilePath = await method(inputFilePath, options);
const actual = await readFile(outputFilePath);
- expect(actualFilePath).to.equal(outputFilePath);
- expect(actual).to.deep.equal(expected);
+ assert.equal(actualFilePath, outputFilePath);
+ assert.deepEqual(actual, expected);
}
});
});
@@ -250,9 +254,11 @@ class Helper {
});
afterEach(() => {
- expect(api.createConverter.callCount).to.equal(1);
- expect(converter.destroy.callCount).to.equal(1);
+ assert.equal(api.createConverter.callCount, 1);
+ assert.equal(converter.destroy.callCount, 1);
+ });
+ afterEach(() => {
api.createConverter.restore();
});
} else {
@@ -295,11 +301,17 @@ class Helper {
const method = testAPI ? api.convert.bind(api) : converter.convert.bind(converter);
if (test.error) {
- await expect(method(input, options)).to.eventually.be.rejectedWith(Error, test.error);
+ try {
+ await method(input, options);
+ // Should have thrown
+ assert.fail();
+ } catch (e) {
+ assert.equal(e.message, test.error);
+ }
} else {
const actual = await method(input, options);
- expect(actual).to.deep.equal(expected);
+ assert.deepEqual(actual, expected);
}
});
});
@@ -329,7 +341,7 @@ class Helper {
const method = testAPI ? api.convert.bind(api) : converter.convert.bind(converter);
const actual = await method(input);
- expect(actual).to.deep.equal(expected);
+ assert.deepEqual(actual, expected);
});
});
}
diff --git a/packages/convert-svg-test-helper/src/index.js b/packages/convert-svg-test-helper/src/index.js
index 093dca0..830b348 100644
--- a/packages/convert-svg-test-helper/src/index.js
+++ b/packages/convert-svg-test-helper/src/index.js
@@ -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
diff --git a/packages/convert-svg-to-jpeg/.npmignore b/packages/convert-svg-to-jpeg/.npmignore
index 05d93bf..d702422 100644
--- a/packages/convert-svg-to-jpeg/.npmignore
+++ b/packages/convert-svg-to-jpeg/.npmignore
@@ -1,3 +1,2 @@
test/
.*
-*.md
diff --git a/packages/convert-svg-to-jpeg/bin/convert-svg-to-jpeg b/packages/convert-svg-to-jpeg/bin/convert-svg-to-jpeg
index 4335fd2..66d0b7d 100755
--- a/packages/convert-svg-to-jpeg/bin/convert-svg-to-jpeg
+++ b/packages/convert-svg-to-jpeg/bin/convert-svg-to-jpeg
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/*
- * 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
diff --git a/packages/convert-svg-to-jpeg/package.json b/packages/convert-svg-to-jpeg/package.json
index c5ad7a6..3273184 100644
--- a/packages/convert-svg-to-jpeg/package.json
+++ b/packages/convert-svg-to-jpeg/package.json
@@ -1,6 +1,6 @@
{
"name": "convert-svg-to-jpeg",
- "version": "0.3.3",
+ "version": "0.4.0",
"description": "Converts SVG to JPEG using headless Chromium",
"homepage": "https://github.com/NotNinja/convert-svg",
"bugs": {
@@ -26,12 +26,11 @@
"url": "https://github.com/NotNinja/convert-svg.git"
},
"dependencies": {
- "convert-svg-core": "^0.3.3"
+ "convert-svg-core": "^0.4.0"
},
"devDependencies": {
- "chai": "^4.1.2",
- "convert-svg-test-helper": "^0.3.3",
- "mocha": "^4.0.1"
+ "convert-svg-test-helper": "^0.4.0",
+ "mocha": "^5.0.0"
},
"bin": {
"convert-svg-to-jpeg": "bin/convert-svg-to-jpeg"
diff --git a/packages/convert-svg-to-jpeg/src/JPEGProvider.js b/packages/convert-svg-to-jpeg/src/JPEGProvider.js
index b226b02..ad321f8 100644
--- a/packages/convert-svg-to-jpeg/src/JPEGProvider.js
+++ b/packages/convert-svg-to-jpeg/src/JPEGProvider.js
@@ -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
diff --git a/packages/convert-svg-to-jpeg/src/index.js b/packages/convert-svg-to-jpeg/src/index.js
index 53e85ac..8e001c8 100644
--- a/packages/convert-svg-to-jpeg/src/index.js
+++ b/packages/convert-svg-to-jpeg/src/index.js
@@ -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
diff --git a/packages/convert-svg-to-jpeg/test/.eslintrc.json b/packages/convert-svg-to-jpeg/test/.eslintrc.json
index bc9fb97..c5ddfe3 100644
--- a/packages/convert-svg-to-jpeg/test/.eslintrc.json
+++ b/packages/convert-svg-to-jpeg/test/.eslintrc.json
@@ -4,6 +4,6 @@
"mocha": true
},
"rules": {
- "no-unused-expressions": "off"
+ "no-undefined": "off"
}
}
diff --git a/packages/convert-svg-to-jpeg/test/JPEGProvider.spec.js b/packages/convert-svg-to-jpeg/test/JPEGProvider.spec.js
index 9d39f91..55fbce1 100644
--- a/packages/convert-svg-to-jpeg/test/JPEGProvider.spec.js
+++ b/packages/convert-svg-to-jpeg/test/JPEGProvider.spec.js
@@ -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
@@ -22,7 +22,7 @@
'use strict';
-const { expect } = require('chai');
+const assert = require('assert');
const { Provider } = require('convert-svg-core');
const pkg = require('../package.json');
@@ -36,26 +36,26 @@ describe('[convert-svg-to-jpeg] JPEGProvider', () => {
});
it('should extend Provider', () => {
- expect(provider).to.be.an.instanceOf(Provider);
+ assert.ok(provider instanceof Provider);
});
describe('#getBackgroundColor', () => {
context('when background option was not specified', () => {
it('should return white color', () => {
- expect(provider.getBackgroundColor({})).to.equal('#FFF');
+ assert.equal(provider.getBackgroundColor({}), '#FFF');
});
});
context('when background option was specified', () => {
it('should return background', () => {
- expect(provider.getBackgroundColor({ background: '#000' })).to.equal('#000');
+ assert.equal(provider.getBackgroundColor({ background: '#000' }), '#000');
});
});
});
describe('#getCLIOptions', () => {
it('should return CLI options', () => {
- expect(provider.getCLIOptions()).to.deep.equal([
+ assert.deepEqual(provider.getCLIOptions(), [
{
flags: '--quality ',
description: 'specify quality for JPEG [100]',
@@ -67,31 +67,31 @@ describe('[convert-svg-to-jpeg] JPEGProvider', () => {
describe('#getExtension', () => {
it('should return output file extension', () => {
- expect(provider.getExtension()).to.equal('jpeg');
+ assert.equal(provider.getExtension(), 'jpeg');
});
});
describe('#getFormat', () => {
it('should return output format', () => {
- expect(provider.getFormat()).to.equal('JPEG');
+ assert.equal(provider.getFormat(), 'JPEG');
});
});
describe('#getScreenshotOptions', () => {
it('should return puppeteer screenshot options with quality option', () => {
- expect(provider.getScreenshotOptions({ quality: 50 })).to.deep.equal({ quality: 50 });
+ assert.deepEqual(provider.getScreenshotOptions({ quality: 50 }), { quality: 50 });
});
});
describe('#getType', () => {
it('should return output type supported as supported by puppeteer screenshots', () => {
- expect(provider.getType()).to.equal('jpeg');
+ assert.equal(provider.getType(), 'jpeg');
});
});
describe('#getVersion', () => {
it('should return version in package.json', () => {
- expect(provider.getVersion()).to.equal(pkg.version);
+ assert.equal(provider.getVersion(), pkg.version);
});
});
@@ -102,7 +102,7 @@ describe('[convert-svg-to-jpeg] JPEGProvider', () => {
provider.parseAPIOptions(options);
- expect(options).to.deep.equal({ quality: 100 });
+ assert.deepEqual(options, { quality: 100 });
});
});
@@ -112,28 +112,37 @@ describe('[convert-svg-to-jpeg] JPEGProvider', () => {
provider.parseAPIOptions(options);
- expect(options).to.deep.equal({ quality: 0 });
+ assert.deepEqual(options, { quality: 0 });
options.quality = 50;
provider.parseAPIOptions(options);
- expect(options).to.deep.equal({ quality: 50 });
+ assert.deepEqual(options, { quality: 50 });
options.quality = 100;
provider.parseAPIOptions(options);
- expect(options).to.deep.equal({ quality: 100 });
+ assert.deepEqual(options, { quality: 100 });
});
});
context('when quality option is out of range', () => {
it('should throw an error', () => {
- expect(() => provider.parseAPIOptions({ quality: -1 })).to.throw(Error,
- 'Value for quality option out of range. Use value between 0-100 (inclusive)');
- expect(() => provider.parseAPIOptions({ quality: 101 })).to.throw(Error,
- 'Value for quality option out of range. Use value between 0-100 (inclusive)');
+ assert.throws(() => {
+ provider.parseAPIOptions({ quality: -1 });
+ }, (error) => {
+ return error instanceof Error &&
+ error.message === 'Value for quality option out of range. Use value between 0-100 (inclusive)';
+ });
+
+ assert.throws(() => {
+ provider.parseAPIOptions({ quality: 101 });
+ }, (error) => {
+ return error instanceof Error &&
+ error.message === 'Value for quality option out of range. Use value between 0-100 (inclusive)';
+ });
});
});
});
@@ -144,11 +153,11 @@ describe('[convert-svg-to-jpeg] JPEGProvider', () => {
provider.parseCLIOptions(options, {});
- expect(options.quality).to.be.undefined;
+ assert.strictEqual(options.quality, undefined);
provider.parseCLIOptions(options, { quality: 50 });
- expect(options.quality).to.equal(50);
+ assert.equal(options.quality, 50);
});
});
});
diff --git a/packages/convert-svg-to-jpeg/test/fixtures/expected/0.jpeg b/packages/convert-svg-to-jpeg/test/fixtures/expected/0.jpeg
index a94715e..c2e1850 100644
Binary files a/packages/convert-svg-to-jpeg/test/fixtures/expected/0.jpeg and b/packages/convert-svg-to-jpeg/test/fixtures/expected/0.jpeg differ
diff --git a/packages/convert-svg-to-jpeg/test/fixtures/expected/11.jpeg b/packages/convert-svg-to-jpeg/test/fixtures/expected/11.jpeg
index e109820..cfd3ac4 100644
Binary files a/packages/convert-svg-to-jpeg/test/fixtures/expected/11.jpeg and b/packages/convert-svg-to-jpeg/test/fixtures/expected/11.jpeg differ
diff --git a/packages/convert-svg-to-jpeg/test/fixtures/expected/15.jpeg b/packages/convert-svg-to-jpeg/test/fixtures/expected/15.jpeg
index 5b2f1d2..db9eb32 100644
Binary files a/packages/convert-svg-to-jpeg/test/fixtures/expected/15.jpeg and b/packages/convert-svg-to-jpeg/test/fixtures/expected/15.jpeg differ
diff --git a/packages/convert-svg-to-jpeg/test/fixtures/expected/16.jpeg b/packages/convert-svg-to-jpeg/test/fixtures/expected/16.jpeg
index 33bda8c..26973c6 100644
Binary files a/packages/convert-svg-to-jpeg/test/fixtures/expected/16.jpeg and b/packages/convert-svg-to-jpeg/test/fixtures/expected/16.jpeg differ
diff --git a/packages/convert-svg-to-jpeg/test/fixtures/expected/2.jpeg b/packages/convert-svg-to-jpeg/test/fixtures/expected/2.jpeg
index 023e52d..31a1677 100644
Binary files a/packages/convert-svg-to-jpeg/test/fixtures/expected/2.jpeg and b/packages/convert-svg-to-jpeg/test/fixtures/expected/2.jpeg differ
diff --git a/packages/convert-svg-to-jpeg/test/fixtures/expected/20.jpeg b/packages/convert-svg-to-jpeg/test/fixtures/expected/20.jpeg
index 30c6907..4a456b3 100644
Binary files a/packages/convert-svg-to-jpeg/test/fixtures/expected/20.jpeg and b/packages/convert-svg-to-jpeg/test/fixtures/expected/20.jpeg differ
diff --git a/packages/convert-svg-to-jpeg/test/fixtures/expected/9.jpeg b/packages/convert-svg-to-jpeg/test/fixtures/expected/9.jpeg
index 48d592d..00e782e 100644
Binary files a/packages/convert-svg-to-jpeg/test/fixtures/expected/9.jpeg and b/packages/convert-svg-to-jpeg/test/fixtures/expected/9.jpeg differ
diff --git a/packages/convert-svg-to-jpeg/test/index.spec.js b/packages/convert-svg-to-jpeg/test/index.spec.js
index ef39bab..7d1c18d 100644
--- a/packages/convert-svg-to-jpeg/test/index.spec.js
+++ b/packages/convert-svg-to-jpeg/test/index.spec.js
@@ -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
diff --git a/packages/convert-svg-to-png/.npmignore b/packages/convert-svg-to-png/.npmignore
index 05d93bf..d702422 100644
--- a/packages/convert-svg-to-png/.npmignore
+++ b/packages/convert-svg-to-png/.npmignore
@@ -1,3 +1,2 @@
test/
.*
-*.md
diff --git a/packages/convert-svg-to-png/bin/convert-svg-to-png b/packages/convert-svg-to-png/bin/convert-svg-to-png
index 96db0e4..3804c0e 100755
--- a/packages/convert-svg-to-png/bin/convert-svg-to-png
+++ b/packages/convert-svg-to-png/bin/convert-svg-to-png
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/*
- * 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
diff --git a/packages/convert-svg-to-png/package.json b/packages/convert-svg-to-png/package.json
index 7571ef2..2a11329 100644
--- a/packages/convert-svg-to-png/package.json
+++ b/packages/convert-svg-to-png/package.json
@@ -1,6 +1,6 @@
{
"name": "convert-svg-to-png",
- "version": "0.3.3",
+ "version": "0.4.0",
"description": "Converts SVG to PNG using headless Chromium",
"homepage": "https://github.com/NotNinja/convert-svg",
"bugs": {
@@ -25,12 +25,11 @@
"url": "https://github.com/NotNinja/convert-svg.git"
},
"dependencies": {
- "convert-svg-core": "^0.3.3"
+ "convert-svg-core": "^0.4.0"
},
"devDependencies": {
- "chai": "^4.1.2",
- "convert-svg-test-helper": "^0.3.3",
- "mocha": "^4.0.1"
+ "convert-svg-test-helper": "^0.4.0",
+ "mocha": "^5.0.0"
},
"bin": {
"convert-svg-to-png": "bin/convert-svg-to-png"
diff --git a/packages/convert-svg-to-png/src/PNGProvider.js b/packages/convert-svg-to-png/src/PNGProvider.js
index 599a7a2..56676f0 100644
--- a/packages/convert-svg-to-png/src/PNGProvider.js
+++ b/packages/convert-svg-to-png/src/PNGProvider.js
@@ -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
diff --git a/packages/convert-svg-to-png/src/index.js b/packages/convert-svg-to-png/src/index.js
index aa9b8a7..822b9c4 100644
--- a/packages/convert-svg-to-png/src/index.js
+++ b/packages/convert-svg-to-png/src/index.js
@@ -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
diff --git a/packages/convert-svg-to-png/test/.eslintrc.json b/packages/convert-svg-to-png/test/.eslintrc.json
index bc9fb97..c37ad2e 100644
--- a/packages/convert-svg-to-png/test/.eslintrc.json
+++ b/packages/convert-svg-to-png/test/.eslintrc.json
@@ -2,8 +2,5 @@
"extends": "../../../.eslintrc.json",
"env": {
"mocha": true
- },
- "rules": {
- "no-unused-expressions": "off"
}
}
diff --git a/packages/convert-svg-to-png/test/PNGProvider.spec.js b/packages/convert-svg-to-png/test/PNGProvider.spec.js
index d4e23aa..d936dc4 100644
--- a/packages/convert-svg-to-png/test/PNGProvider.spec.js
+++ b/packages/convert-svg-to-png/test/PNGProvider.spec.js
@@ -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
@@ -22,7 +22,7 @@
'use strict';
-const { expect } = require('chai');
+const assert = require('assert');
const { Provider } = require('convert-svg-core');
const pkg = require('../package.json');
@@ -36,64 +36,64 @@ describe('[convert-svg-to-png] PNGProvider', () => {
});
it('should extend Provider', () => {
- expect(provider).to.be.an.instanceOf(Provider);
+ assert.ok(provider instanceof Provider);
});
describe('#getBackgroundColor', () => {
context('when background option was not specified', () => {
it('should return transparent color', () => {
- expect(provider.getBackgroundColor({})).to.equal('transparent');
+ assert.equal(provider.getBackgroundColor({}), 'transparent');
});
});
context('when background option was specified', () => {
it('should return background', () => {
- expect(provider.getBackgroundColor({ background: '#000' })).to.equal('#000');
+ assert.equal(provider.getBackgroundColor({ background: '#000' }), '#000');
});
});
});
describe('#getCLIOptions', () => {
it('should return null', () => {
- expect(provider.getCLIOptions()).to.be.null;
+ assert.strictEqual(provider.getCLIOptions(), null);
});
});
describe('#getExtension', () => {
it('should return output file extension', () => {
- expect(provider.getExtension()).to.equal('png');
+ assert.equal(provider.getExtension(), 'png');
});
});
describe('#getFormat', () => {
it('should return output format', () => {
- expect(provider.getFormat()).to.equal('PNG');
+ assert.equal(provider.getFormat(), 'PNG');
});
});
describe('#getScreenshotOptions', () => {
context('when background option was not specified', () => {
it('should return puppeteer screenshot options with background omitted', () => {
- expect(provider.getScreenshotOptions({})).to.deep.equal({ omitBackground: true });
+ assert.deepEqual(provider.getScreenshotOptions({}), { omitBackground: true });
});
});
context('when background option was specified', () => {
it('should return puppeteer screenshot options with background', () => {
- expect(provider.getScreenshotOptions({ background: '#000' })).to.deep.equal({ omitBackground: false });
+ assert.deepEqual(provider.getScreenshotOptions({ background: '#000' }), { omitBackground: false });
});
});
});
describe('#getType', () => {
it('should return output type supported as supported by puppeteer screenshots', () => {
- expect(provider.getType()).to.equal('png');
+ assert.equal(provider.getType(), 'png');
});
});
describe('#getVersion', () => {
it('should return version in package.json', () => {
- expect(provider.getVersion()).to.equal(pkg.version);
+ assert.equal(provider.getVersion(), pkg.version);
});
});
@@ -103,7 +103,7 @@ describe('[convert-svg-to-png] PNGProvider', () => {
provider.parseAPIOptions(options);
- expect(options).to.deep.equal({});
+ assert.deepEqual(options, {});
});
});
@@ -113,7 +113,7 @@ describe('[convert-svg-to-png] PNGProvider', () => {
provider.parseCLIOptions(options);
- expect(options).to.deep.equal({});
+ assert.deepEqual(options, {});
});
});
});
diff --git a/packages/convert-svg-to-png/test/fixtures/expected/0.png b/packages/convert-svg-to-png/test/fixtures/expected/0.png
index 32cee6d..5e3473a 100644
Binary files a/packages/convert-svg-to-png/test/fixtures/expected/0.png and b/packages/convert-svg-to-png/test/fixtures/expected/0.png differ
diff --git a/packages/convert-svg-to-png/test/fixtures/expected/11.png b/packages/convert-svg-to-png/test/fixtures/expected/11.png
index 756a30f..b323e47 100644
Binary files a/packages/convert-svg-to-png/test/fixtures/expected/11.png and b/packages/convert-svg-to-png/test/fixtures/expected/11.png differ
diff --git a/packages/convert-svg-to-png/test/fixtures/expected/15.png b/packages/convert-svg-to-png/test/fixtures/expected/15.png
index 53689b9..1b3f3ed 100644
Binary files a/packages/convert-svg-to-png/test/fixtures/expected/15.png and b/packages/convert-svg-to-png/test/fixtures/expected/15.png differ
diff --git a/packages/convert-svg-to-png/test/fixtures/expected/16.png b/packages/convert-svg-to-png/test/fixtures/expected/16.png
index c468eb6..72bb03f 100644
Binary files a/packages/convert-svg-to-png/test/fixtures/expected/16.png and b/packages/convert-svg-to-png/test/fixtures/expected/16.png differ
diff --git a/packages/convert-svg-to-png/test/fixtures/expected/2.png b/packages/convert-svg-to-png/test/fixtures/expected/2.png
index 53b4a7f..711a64f 100644
Binary files a/packages/convert-svg-to-png/test/fixtures/expected/2.png and b/packages/convert-svg-to-png/test/fixtures/expected/2.png differ
diff --git a/packages/convert-svg-to-png/test/fixtures/expected/20.png b/packages/convert-svg-to-png/test/fixtures/expected/20.png
index 88cbc4a..e805906 100644
Binary files a/packages/convert-svg-to-png/test/fixtures/expected/20.png and b/packages/convert-svg-to-png/test/fixtures/expected/20.png differ
diff --git a/packages/convert-svg-to-png/test/fixtures/expected/9.png b/packages/convert-svg-to-png/test/fixtures/expected/9.png
index b45a8da..6c56b2f 100644
Binary files a/packages/convert-svg-to-png/test/fixtures/expected/9.png and b/packages/convert-svg-to-png/test/fixtures/expected/9.png differ
diff --git a/packages/convert-svg-to-png/test/index.spec.js b/packages/convert-svg-to-png/test/index.spec.js
index 71a4d25..02045b9 100644
--- a/packages/convert-svg-to-png/test/index.spec.js
+++ b/packages/convert-svg-to-png/test/index.spec.js
@@ -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