Skip to content

Commit

Permalink
chore: Update development
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyfarrell committed Jun 6, 2019
1 parent 8b6ace4 commit e494be0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "fastify-babel",
"version": "1.2.0",
"description": "Fastify Babel plugin for development servers",
"main": "index.js",
"scripts": {
"release": "standard-version --sign",
"test": "xo && nyc ava"
Expand All @@ -28,27 +27,27 @@
},
"homepage": "https://github.com/cfware/fastify-babel#readme",
"dependencies": {
"fastify-plugin": "^1.5.0"
"fastify-plugin": "^1.6.0"
},
"peerDependencies": {
"@babel/core": "^7.3.3"
"@babel/core": "^7.4.5"
},
"devDependencies": {
"@babel/core": "^7.3.3",
"@cfware/nyc": "^0.4.2",
"ava": "^1.2.1",
"babel-plugin-bare-import-rewrite": "^1.3.1",
"fastify": "^2.0.0",
"fastify-static": "^2.3.4",
"node-fetch": "^2.3.0",
"nyc": "^14.1.0",
"@babel/core": "^7.4.5",
"@cfware/nyc": "^0.5.0",
"ava": "^2.0.0",
"babel-plugin-bare-import-rewrite": "^1.5.0",
"fastify": "^2.4.1",
"fastify-static": "^2.4.0",
"node-fetch": "^2.6.0",
"nyc": "^14.1.1",
"standard-version": "^6.0.1",
"string-to-stream": "^1.1.1",
"xo": "^0.24.0"
},
"xo": {
"ignores": [
"test/fixtures/**"
"fixtures/**"
]
}
}
14 changes: 7 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const babelrcError = {

async function createServer(t, babelTypes, maskError, babelrc = {plugins: ['bare-import-rewrite']}) {
const appOpts = {
root: path.join(__dirname, 'fixtures'),
root: path.join(__dirname, '..', 'fixtures'),
prefix: '/'
};
/* Use of babel-plugin-bare-import-rewrite ensures fastify-babel does the
Expand Down Expand Up @@ -83,22 +83,22 @@ async function runTest(t, url, expected, {noBabel, babelTypes, babelrc, maskErro
t.is(body.replace(/\r\n/, '\n'), expected);
}

test('static app js', runTest, '/test.js', babelResult);
test('static app js with x-no-babel', runTest, '/test.js', staticContent, {noBabel: true});
test('static app js', runTest, '/import.js', babelResult);
test('static app js with x-no-babel', runTest, '/import.js', staticContent, {noBabel: true});
test('static app txt', runTest, '/test.txt', staticContent);
test('static app txt with custom babelTypes regex', runTest, '/test.txt', babelResult, {babelTypes: /text/});
test('dynamic undefined js', runTest, '/undefined.js', '');
test('dynamic null js', runTest, '/null.js', '');
test('dynamic js without filename', runTest, '/nofile.js', babelResult);
test('from node_module', runTest, `/${fromModuleSource}`, fromModuleResult);
test('default error handling', runTest, '/error.js', JSON.stringify(errorMessage));
test('babel exception handling', runTest, '/test.js', JSON.stringify(babelrcError), {babelrc: {babelrcBroken}});
test('don\'t hide error details', runTest, '/test.js', JSON.stringify(unmaskedError), {babelrc: {babelrcBroken}, maskError: false});
test('babel exception handling', runTest, '/import.js', JSON.stringify(babelrcError), {babelrc: {babelrcBroken}});
test('don\'t hide error details', runTest, '/import.js', JSON.stringify(unmaskedError), {babelrc: {babelrcBroken}, maskError: false});

test('static app js caching', async t => {
const host = await createServer(t);
const res1 = await fetch(host + '/test.js');
const res2 = await fetch(host + '/test.js', {
const res1 = await fetch(host + '/import.js');
const res2 = await fetch(host + '/import.js', {
headers: {
'If-None-Match': res1.headers.get('etag')
}
Expand Down

0 comments on commit e494be0

Please sign in to comment.