Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Don't Merge) Test refactor #194

Merged
merged 3 commits into from
Jul 23, 2016
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
8 changes: 5 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# editorconfig.org
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
39 changes: 32 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
.DS_Store
# Logs
logs
*.log
node_modules
build
*.node
*.orig
.idea
sandbox

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript

# Garbage files
.DS_Store

# Generated by integration tests
test/out-fixtures/
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
sudo: required
language: node_js
node_js:
- 'stable'
- '6'
- '5'
- '4'
- '0.12'
- '0.10'
before_script:
- find test -type d -exec chmod g+s {} \;
- sudo chown root test/not-owned/
- sudo chown root test/not-owned/not-owned.txt
- sudo chown root test/fixtures/not-owned/
- sudo chown root test/fixtures/not-owned/not-owned.txt
after_script:
- npm run coveralls
35 changes: 18 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
Copyright (c) 2013-2016 Fractal <[email protected]>
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
Copyright (c) 2013 Blaine Bublitz <[email protected]>, Eric Schoffstall <[email protected]> and other contributors

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ Type: `Boolean`

Default: `false`

##### `options.followSymlinks` - `true` if you want
##### `options.followSymlinks`

Whether or not to recursively resolve symlinks to their targets. Setting to `false` to preserve them as symlinks and make `file.symlink` equal the original symlink's target path.

Type: `Boolean`

Default: `true`

##### `options.dots` - `true`
##### `options.dots`

Whether or not you want globs to match on dot files or not (e.g. `.gitignore`)

Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environment:
- nodejs_version: "0.12"
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"

install:
- ps: Install-Product node $env:nodejs_version
Expand Down
4 changes: 3 additions & 1 deletion lib/prepare-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ function prepareWrite(outFolder, file, opt, callback) {
file.stat.mode = options.mode;
file.flag = options.flag;
file.cwd = cwd;
file.base = basePath;
// Ensure the base always ends with a separator
// TODO: add a test for this
file.base = path.normalize(basePath + path.sep);
Copy link

@jonschlinkert jonschlinkert Jul 23, 2016

Choose a reason for hiding this comment

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

since path.normalize() will fix 'foo//' to foo/ (or backslashes if windows), to be safe I would consider doing basePath + '/' + path.sep (edited: nvm I misread path.sep to be some other path variable. I'm pretty sure that will always normalize out to have a path at the end)

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually think this needs to be pushed down into vinyl but I will do that separately from this PR

file.path = writePath;

fo.mkdirp(writeFolder, options.dirMode, onMkdirp);
Expand Down
62 changes: 34 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
{
"name": "vinyl-fs",
"description": "Vinyl adapter for the file system",
"version": "2.4.3",
"homepage": "http://github.com/wearefractal/vinyl-fs",
"repository": "git://github.com/wearefractal/vinyl-fs.git",
"author": "Fractal <[email protected]> (http://wearefractal.com/)",
"main": "./index.js",
"description": "Vinyl adapter for the file system.",
"author": "Gulp Team <[email protected]> (http://gulpjs.com/)",
"contributors": [
"Eric Schoffstall <[email protected]>",
"Blaine Bublitz <[email protected]>"
],
"repository": "gulpjs/vinyl-fs",
"license": "MIT",
"engines": {
"node": ">= 0.10"
},
"main": "index.js",
"files": [
"LICENSE",
"index.js",
"lib"
],
"scripts": {
"lint": "eslint . && jscs index.js lib/ test/",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
},
"dependencies": {
"duplexify": "^3.2.0",
"flush-write-stream": "^1.0.0",
Expand All @@ -31,33 +46,24 @@
"vinyl": "^1.0.0"
},
"devDependencies": {
"buffer-equal": "^0.0.1",
"default-resolution": "^1.0.1",
"del": "^2.2.0",
"eslint": "^1.10.3",
"eslint-config-gulp": "^2.0.0",
"expect": "^1.14.0",
"from2": "^2.1.1",
"github-changes": "^1.0.1",
"istanbul": "^0.3.0",
"istanbul-coveralls": "^1.0.1",
"expect": "^1.19.0",
"istanbul": "^0.4.3",
"istanbul-coveralls": "^1.0.3",
"jscs": "^2.4.0",
"jscs-preset-gulp": "^1.0.0",
"mocha": "^2.0.0",
"mocha-lcov-reporter": "^1.0.0",
"rimraf": "^2.2.5",
"should": "^7.0.0",
"sinon": "^1.10.3"
},
"scripts": {
"lint": "eslint . && jscs index.js lib/ test/",
"test": "npm run lint && mocha",
"cover": "istanbul cover _mocha",
"coveralls": "npm run cover && istanbul-coveralls",
"changelog": "github-changes -o gulpjs -r vinyl-fs -b master -f ./CHANGELOG.md --order-semver --use-commit-body"
},
"engines": {
"node": ">=0.10"
"mississippi": "^1.2.0",
"mocha": "^2.4.5"
},
"license": "MIT"
"keywords": [
"gulp",
"vinyl-adapter",
"vinyl",
"file",
"file system",
"fs",
"streams"
]
}
9 changes: 6 additions & 3 deletions test/default-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ var defaultValue = require('../lib/default-value');

describe('defaultVaule', function() {

it('returns the value if the value is not null', function() {
it('returns the value if the value is not null', function(done) {
expect(defaultValue('defaultValue', 1)).toBe(1);
done();
});

it('returns the default value if the value is undefined', function() {
it('returns the default value if the value is undefined', function(done) {
expect(defaultValue('defaultValue', undefined)).toBe('defaultValue');
done();
});

it('returns the default value if the value is null', function() {
it('returns the default value if the value is null', function(done) {
expect(defaultValue('defaultValue', null)).toBe('defaultValue');
done();
});

});
Loading