Skip to content

Commit 992f117

Browse files
committed
deps update
1 parent 61a09b1 commit 992f117

File tree

5 files changed

+62
-49
lines changed

5 files changed

+62
-49
lines changed

.editorconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[GNUmakefile]
12+
indent_style = tab
13+
14+
[Makefile]
15+
indent_style = tab
16+
17+
[makefile]
18+
indent_style = tab
19+
20+
# cheat sheet: http://EditorConfig.org

.gitignore

+6-23
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
11
# Logs
2-
logs
3-
*.log
2+
npm-debug.log*
43

5-
# Runtime data
6-
pids
7-
*.pid
8-
*.seed
9-
10-
# Directory for instrumented libs generated by jscoverage/JSCover
11-
lib-cov
12-
13-
# Coverage directory used by tools like istanbul
14-
coverage
15-
16-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17-
.grunt
18-
19-
# node-waf configuration
20-
.lock-wscript
4+
# Dependency directories
5+
node_modules
216

22-
# Compiled binary addons (http://nodejs.org/api/addons.html)
23-
build/Release
7+
# Optional npm cache directory
8+
.npm
249

25-
# Dependency directory
26-
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27-
node_modules
10+
yarn.lock

.npmignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
.git*
1+
.editorconfig
2+
.gitignore
3+
.npmignore
24
.travis.yml
35
test.js
6+
yarn.lock

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
"description": "Helper for building generic names, similar to webpack",
55
"main": "index.js",
66
"scripts": {
7-
"test": "mocha"
7+
"test": "tape test.js"
88
},
99
"repository": {
1010
"type": "git",
1111
"url": "git+https://github.com/css-modules/generic-names.git"
1212
},
1313
"keywords": [
1414
"css-modules",
15+
"postcss-modules-scope",
1516
"webpack"
1617
],
1718
"author": "Alexey Litvinov",
@@ -20,10 +21,10 @@
2021
"url": "https://github.com/css-modules/generic-names/issues"
2122
},
2223
"homepage": "https://github.com/css-modules/generic-names#readme",
23-
"dependencies": {
24-
"loader-utils": "^0.2.11"
25-
},
2624
"devDependencies": {
27-
"mocha": "^2.3.3"
25+
"tape": "^4.6.2"
26+
},
27+
"dependencies": {
28+
"loader-utils": "^0.2.16"
2829
}
2930
}

test.js

+26-20
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1-
describe('generic-names', function () {
2-
'use strict';
3-
4-
var assert = require('assert');
5-
var genericNames = require('.');
6-
7-
it('should use cwd if no context provided', function () {
8-
var generate = genericNames('[name]__[local]___[hash:base64:5]');
9-
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___2e670');
10-
});
11-
12-
it('should generate another hash for the provided context', function () {
13-
var generate = genericNames('[name]__[local]___[hash:base64:5]', {context: '/test'});
14-
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___19xFw');
15-
});
16-
17-
it('should generate another hash for the provided hashPrefix', function () {
18-
var generate = genericNames('[name]__[local]___[hash:base64:5]', {context: '/test', hashPrefix: '--'});
19-
assert.equal(generate('foo', '/test/case/source.css'), 'source__foo___3T0Un');
20-
});
1+
'use strict';
2+
3+
const genericNames = require('./index');
4+
const test = require('tape');
5+
6+
const pattern = '[name]__[local]___[hash:base64:5]';
7+
8+
test('use `cwd` if no context was provided', t => {
9+
const generate = genericNames(pattern);
10+
11+
t.equal(generate('foo', '/test/case/source.css'), 'source__foo___2e670');
12+
t.end();
13+
});
14+
15+
test('generate distinct hash for the provided context', t => {
16+
const generate = genericNames(pattern, {context: '/test'});
17+
18+
t.equal(generate('foo', '/test/case/source.css'), 'source__foo___19xFw');
19+
t.end();
20+
});
21+
22+
test('generate distinct hash for the provided hashPrefix', t => {
23+
const generate = genericNames(pattern, {context: '/test', hashPrefix: '--'});
24+
25+
t.equal(generate('foo', '/test/case/source.css'), 'source__foo___3T0Un');
26+
t.end();
2127
});

0 commit comments

Comments
 (0)