commit
d243a071ee
7 changed files with 184 additions and 0 deletions
@ -0,0 +1,73 @@ |
|||||
|
## Node |
||||
|
package-lock.json |
||||
|
|
||||
|
# Logs |
||||
|
logs |
||||
|
*.log |
||||
|
npm-debug.log* |
||||
|
|
||||
|
# Runtime data |
||||
|
pids |
||||
|
*.pid |
||||
|
*.seed |
||||
|
*.pid.lock |
||||
|
|
||||
|
# Directory for instrumented libs generated by jscoverage/JSCover |
||||
|
lib-cov |
||||
|
|
||||
|
# Coverage directory used by tools like istanbul |
||||
|
coverage |
||||
|
|
||||
|
# nyc test coverage |
||||
|
.nyc_output |
||||
|
|
||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) |
||||
|
.grunt |
||||
|
|
||||
|
# node-waf configuration |
||||
|
.lock-wscript |
||||
|
|
||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html) |
||||
|
build/Release |
||||
|
|
||||
|
# Dependency directories |
||||
|
node_modules |
||||
|
jspm_packages |
||||
|
|
||||
|
# Optional npm cache directory |
||||
|
.npm |
||||
|
|
||||
|
# Optional eslint cache |
||||
|
.eslintcache |
||||
|
|
||||
|
# Optional REPL history |
||||
|
.node_repl_history |
||||
|
|
||||
|
## OS X |
||||
|
|
||||
|
*.DS_Store |
||||
|
.AppleDouble |
||||
|
.LSOverride |
||||
|
|
||||
|
# Icon must end with two \r |
||||
|
Icon |
||||
|
|
||||
|
|
||||
|
# Thumbnails |
||||
|
._* |
||||
|
|
||||
|
# Files that might appear in the root of a volume |
||||
|
.DocumentRevisions-V100 |
||||
|
.fseventsd |
||||
|
.Spotlight-V100 |
||||
|
.TemporaryItems |
||||
|
.Trashes |
||||
|
.VolumeIcon.icns |
||||
|
.com.apple.timemachine.donotpresent |
||||
|
|
||||
|
# Directories potentially created on remote AFP share |
||||
|
.AppleDB |
||||
|
.AppleDesktop |
||||
|
Network Trash Folder |
||||
|
Temporary Items |
||||
|
.apdisk |
@ -0,0 +1,10 @@ |
|||||
|
language: node_js |
||||
|
node_js: |
||||
|
- '8' |
||||
|
- '6' |
||||
|
- '4' |
||||
|
script: npm test |
||||
|
after_success: npm run coverage |
||||
|
notifications: |
||||
|
email: |
||||
|
on_success: never |
@ -0,0 +1,21 @@ |
|||||
|
MIT License |
||||
|
|
||||
|
Copyright (c) 2017 Luke Childs |
||||
|
|
||||
|
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 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. |
@ -0,0 +1,17 @@ |
|||||
|
# requireable |
||||
|
|
||||
|
> Allows current module to require itself in tests |
||||
|
|
||||
|
[](https://travis-ci.org/lukechilds/requireable) |
||||
|
[](https://coveralls.io/github/lukechilds/requireable?branch=master) |
||||
|
[](https://www.npmjs.com/package/requireable) |
||||
|
|
||||
|
## Install |
||||
|
|
||||
|
```shell |
||||
|
npm install --save-dev requireable |
||||
|
``` |
||||
|
|
||||
|
## License |
||||
|
|
||||
|
MIT © Luke Childs |
@ -0,0 +1,43 @@ |
|||||
|
{ |
||||
|
"name": "requireable", |
||||
|
"version": "0.0.0", |
||||
|
"description": "Allows current module to require itself in tests", |
||||
|
"main": "src/index.js", |
||||
|
"scripts": { |
||||
|
"test": "xo && nyc ava", |
||||
|
"coverage": "nyc report --reporter=text-lcov | coveralls" |
||||
|
}, |
||||
|
"xo": { |
||||
|
"extends": "xo-lukechilds" |
||||
|
}, |
||||
|
"repository": { |
||||
|
"type": "git", |
||||
|
"url": "git+https://github.com/lukechilds/requireable.git" |
||||
|
}, |
||||
|
"keywords": [ |
||||
|
"find", |
||||
|
"require", |
||||
|
"requireable", |
||||
|
"self", |
||||
|
"root", |
||||
|
"current", |
||||
|
"module" |
||||
|
], |
||||
|
"author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)", |
||||
|
"license": "MIT", |
||||
|
"bugs": { |
||||
|
"url": "https://github.com/lukechilds/requireable/issues" |
||||
|
}, |
||||
|
"homepage": "https://github.com/lukechilds/requireable", |
||||
|
"dependencies": { |
||||
|
"find-root": "^1.1.0", |
||||
|
"mock-require": "^2.0.2" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"ava": "^0.19.1", |
||||
|
"coveralls": "^2.13.1", |
||||
|
"eslint-config-xo-lukechilds": "^1.0.0", |
||||
|
"nyc": "^10.3.2", |
||||
|
"xo": "^0.19.0" |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const findRoot = require('find-root'); |
||||
|
const mock = require('mock-require'); |
||||
|
|
||||
|
const pkg = { success: false }; |
||||
|
|
||||
|
try { |
||||
|
pkg.path = findRoot(process.cwd()); |
||||
|
pkg.name = require(pkg.path + '/package.json').name; |
||||
|
mock(pkg.name, () => require(pkg.path)); |
||||
|
pkg.success = true; |
||||
|
} catch (err) {} |
||||
|
|
||||
|
module.exports = pkg; |
@ -0,0 +1,5 @@ |
|||||
|
import test from 'ava'; |
||||
|
|
||||
|
test(`importing doesn't throw`, t => { |
||||
|
t.notThrows(() => require('../')); |
||||
|
}); |
Loading…
Reference in new issue