-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
4,075 additions
and
3,819 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"env", | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "8.10" | ||
"node": "12.20.0" | ||
} | ||
} | ||
] | ||
], | ||
"plugins": ["syntax-object-rest-spread"] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
module.exports = { | ||
extends: ['standard', 'prettier', 'prettier/standard'], | ||
extends: ['standard', 'prettier'], | ||
parser: '@babel/eslint-parser', | ||
env: { | ||
es6: true, | ||
node: true | ||
node: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 6 | ||
ecmaVersion: 6, | ||
}, | ||
plugins: ['prettier'], | ||
plugins: ['@babel', 'prettier'], | ||
rules: { | ||
'prettier/prettier': 'warn' | ||
} | ||
} | ||
'prettier/prettier': 'warn', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
"author": "Brian Beck <[email protected]>", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=8.10" | ||
"node": ">=12.20.0" | ||
}, | ||
"main": "lib/index.js", | ||
"files": [ | ||
|
@@ -45,11 +45,11 @@ | |
}, | ||
"ava": { | ||
"require": [ | ||
"babel-register" | ||
"@babel/register" | ||
], | ||
"files": [ | ||
"src/**/*.test.js", | ||
"test" | ||
"test/**/*.test.js" | ||
] | ||
}, | ||
"ava-nock": { | ||
|
@@ -59,7 +59,6 @@ | |
] | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true | ||
}, | ||
"lint-staged": { | ||
|
@@ -73,39 +72,40 @@ | |
] | ||
}, | ||
"peerDependencies": { | ||
"ava": ">=0.23.0 <1" | ||
"ava": "^1.0.0 || ^2.0.0 || ^3.0.0" | ||
}, | ||
"dependencies": { | ||
"debug": "^3.1.0", | ||
"fs-extra": "^7.0.0", | ||
"debug": "^4.3.1", | ||
"fs-extra": "^9.1.0", | ||
"json-parse-better-errors": "^1.0.2", | ||
"json-stable-stringify": "^1.0.1", | ||
"nock": "^9.4.4", | ||
"object-hash": "^1.3.0", | ||
"temp-write": "^3.4.0" | ||
"nock": "^13.0.11", | ||
"object-hash": "^2.1.1", | ||
"temp-write": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.25.0", | ||
"axios": "^0.18.0", | ||
"babel-cli": "^6.26.0", | ||
"babel-plugin-syntax-object-rest-spread": "^6.13.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-register": "^6.26.0", | ||
"eslint": "^5.3.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.13.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-prettier": "^2.6.2", | ||
"eslint-plugin-promise": "^3.8.0", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"husky": "^0.14.3", | ||
"isomorphic-fetch": "^2.2.1", | ||
"lint-staged": "^7.2.0", | ||
"nyc": "^12.0.2", | ||
"prettier": "^1.14.0", | ||
"request": "^2.87.0", | ||
"rimraf": "^2.6.2", | ||
"uuid": "^3.3.2" | ||
"@babel/cli": "^7.13.14", | ||
"@babel/core": "^7.13.14", | ||
"@babel/eslint-parser": "^7.13.14", | ||
"@babel/eslint-plugin": "^7.13.15", | ||
"@babel/preset-env": "^7.13.14", | ||
"@babel/register": "^7.13.14", | ||
"ava": "^4.0.0-alpha.2", | ||
"axios": "^0.21.1", | ||
"eslint": "^7.24.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-config-standard": "^16.0.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"husky": "^6.0.0", | ||
"isomorphic-fetch": "^3.0.0", | ||
"lint-staged": "^10.5.4", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.2.1", | ||
"request": "^2.88.2", | ||
"rimraf": "^3.0.2", | ||
"uuid": "^8.3.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import parseJSON from 'json-parse-better-errors' | ||
import stringifyJSON from 'json-stable-stringify' | ||
import { ensureDir, move } from 'fs-extra' | ||
import tempWrite from 'temp-write' | ||
import createLogger from 'debug' | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import parseJSON from 'json-parse-better-errors'; | ||
import stringifyJSON from 'json-stable-stringify'; | ||
import { ensureDir, move } from 'fs-extra'; | ||
import tempWrite from 'temp-write'; | ||
import createLogger from 'debug'; | ||
|
||
const debug = createLogger('ava-nock:fixtures') | ||
const debug = createLogger('ava-nock:fixtures'); | ||
|
||
export function readFixture(filename) { | ||
filename = path.relative(process.cwd(), filename) | ||
filename = path.relative(process.cwd(), filename); | ||
return new Promise((resolve, reject) => { | ||
debug(`Reading fixture: ${filename}`) | ||
debug(`Reading fixture: ${filename}`); | ||
fs.readFile(filename, 'utf8', (err, data) => { | ||
if (err) { | ||
reject(err) | ||
reject(err); | ||
} else { | ||
resolve(parseJSON(data)) | ||
resolve(parseJSON(data)); | ||
} | ||
}) | ||
}) | ||
}); | ||
}); | ||
} | ||
|
||
export function writeFixture(filename, data, options) { | ||
filename = path.relative(process.cwd(), filename) | ||
const output = stringifyJSON(data, { space: 2 }) + '\n' | ||
debug(`Writing fixture to temporary file.`) | ||
filename = path.relative(process.cwd(), filename); | ||
const output = stringifyJSON(data, { space: 2 }) + '\n'; | ||
debug(`Writing fixture to temporary file.`); | ||
return tempWrite(output) | ||
.then(tempFile => { | ||
const dirname = path.dirname(filename) | ||
debug(`Ensuring fixture directory exists: ${dirname}`) | ||
return ensureDir(dirname).then(() => tempFile) | ||
}) | ||
.then(tempFile => { | ||
debug(`Moving fixture into place: ${filename}`) | ||
return move(tempFile, filename, options) | ||
.then((tempFile) => { | ||
const dirname = path.dirname(filename); | ||
debug(`Ensuring fixture directory exists: ${dirname}`); | ||
return ensureDir(dirname).then(() => tempFile); | ||
}) | ||
.then((tempFile) => { | ||
debug(`Moving fixture into place: ${filename}`); | ||
return move(tempFile, filename, options); | ||
}); | ||
} |
Oops, something went wrong.