Skip to content

Commit

Permalink
Rename commonjs to cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
pahen committed Sep 6, 2016
1 parent 9d26bb7 commit 8c56037
Show file tree
Hide file tree
Showing 33 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"lint": "eslint bin/cli.js lib test/*.js",
"debug": "node bin/cli.js --debug bin lib",
"generate": "npm run generate:small && npm run generate:madge",
"generate:small": "bin/cli.js --image /tmp/simple.svg test/commonjs/circular/a.js",
"generate:small": "bin/cli.js --image /tmp/simple.svg test/cjs/circular/a.js",
"generate:madge": "bin/cli.js --image /tmp/madge.svg bin lib"
},
"dependencies": {
Expand Down
26 changes: 13 additions & 13 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('API', () => {
});

it('returns a Promise', () => {
madge(__dirname + '/commonjs/a.js').should.be.Promise(); // eslint-disable-line new-cap
madge(__dirname + '/cjs/a.js').should.be.Promise(); // eslint-disable-line new-cap
});

it('throws error if file or directory does not exists', (done) => {
Expand All @@ -27,7 +27,7 @@ describe('API', () => {
});

it('takes single file as path', (done) => {
madge(__dirname + '/commonjs/a.js').then((res) => {
madge(__dirname + '/cjs/a.js').then((res) => {
res.obj().should.eql({
'a': ['b', 'c'],
'b': ['c'],
Expand All @@ -38,7 +38,7 @@ describe('API', () => {
});

it('takes an array of files as path and combines the result', (done) => {
madge([__dirname + '/commonjs/a.js', __dirname + '/commonjs/normal/d.js']).then((res) => {
madge([__dirname + '/cjs/a.js', __dirname + '/cjs/normal/d.js']).then((res) => {
res.obj().should.eql({
'a': ['b', 'c'],
'b': ['c'],
Expand All @@ -50,7 +50,7 @@ describe('API', () => {
});

it('take a single directory as path and find files in it', (done) => {
madge(__dirname + '/commonjs/normal').then((res) => {
madge(__dirname + '/cjs/normal').then((res) => {
res.obj().should.eql({
'a': ['sub/b'],
'd': [],
Expand All @@ -62,7 +62,7 @@ describe('API', () => {
});

it('takes an array of directories as path and compute the basedir correctly', (done) => {
madge([__dirname + '/commonjs/multibase/1', __dirname + '/commonjs/multibase/2']).then((res) => {
madge([__dirname + '/cjs/multibase/1', __dirname + '/cjs/multibase/2']).then((res) => {
res.obj().should.eql({
'1/a': [],
'2/b': []
Expand All @@ -89,7 +89,7 @@ describe('API', () => {
});

it('can exclude modules using RegExp', (done) => {
madge(__dirname + '/commonjs/a.js', {
madge(__dirname + '/cjs/a.js', {
excludeRegExp: ['^b$']
}).then((res) => {
res.obj().should.eql({
Expand All @@ -102,7 +102,7 @@ describe('API', () => {

describe('obj()', () => {
it('returns dependency object', (done) => {
madge(__dirname + '/commonjs/a.js').then((res) => {
madge(__dirname + '/cjs/a.js').then((res) => {
res.obj().should.eql({
a: ['b', 'c'],
b: ['c'],
Expand All @@ -115,7 +115,7 @@ describe('API', () => {

describe('dot()', () => {
it('returns a promise resolved with graphviz DOT output', (done) => {
madge(__dirname + '/commonjs/b.js')
madge(__dirname + '/cjs/b.js')
.then((res) => res.dot())
.then((output) => {
output.should.eql('digraph G {\n "b";\n "c";\n "b" -> "c";\n}\n');
Expand All @@ -127,7 +127,7 @@ describe('API', () => {

describe('depends()', () => {
it('returns modules that depends on another', (done) => {
madge(__dirname + '/commonjs/a.js').then((res) => {
madge(__dirname + '/cjs/a.js').then((res) => {
res.depends('c').should.eql(['a', 'b']);
done();
}).catch(done);
Expand All @@ -146,7 +146,7 @@ describe('API', () => {
});

it('rejects if a filename is not supplied', (done) => {
madge(__dirname + '/commonjs/a.js')
madge(__dirname + '/cjs/a.js')
.then((res) => res.image())
.catch((err) => {
err.message.should.eql('imagePath not provided');
Expand All @@ -155,7 +155,7 @@ describe('API', () => {
});

it('rejects on unsupported image format', (done) => {
madge(__dirname + '/commonjs/a.js')
madge(__dirname + '/cjs/a.js')
.then((res) => res.image('image.zyx'))
.catch((err) => {
err.message.should.match(/Format: "zyx" not recognized/);
Expand All @@ -164,7 +164,7 @@ describe('API', () => {
});

it('rejects if graphviz is not installed', (done) => {
madge(__dirname + '/commonjs/a.js', {graphVizPath: '/invalid/path'})
madge(__dirname + '/cjs/a.js', {graphVizPath: '/invalid/path'})
.then((res) => res.image('image.png'))
.catch((err) => {
err.message.should.match(/Could not execute .*gvpr \-V/);
Expand All @@ -173,7 +173,7 @@ describe('API', () => {
});

it('writes image to file', (done) => {
madge(__dirname + '/commonjs/a.js')
madge(__dirname + '/cjs/a.js')
.then((res) => res.image(imagePath))
.then((writtenImagePath) => {
writtenImagePath.should.eql(imagePath);
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs.js → test/cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const madge = require('../lib/api');
require('should');

describe('CommonJS', () => {
const dir = __dirname + '/commonjs';
const dir = __dirname + '/cjs';

it('finds recursive dependencies', (done) => {
madge(dir + '/normal/a.js').then((res) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Flow', () => {
});

it('extracts CommonsJS module dependencies', (done) => {
madge(dir + '/commonjs/calc.js').then((res) => {
madge(dir + '/cjs/calc.js').then((res) => {
res.obj().should.eql({
'math': [],
'calc': ['math']
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 8c56037

Please sign in to comment.