From f9a80591adc48a9656ae7ae429b6bcaf0fdf9e97 Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Thu, 16 Nov 2017 15:17:15 +0300 Subject: [PATCH] Compile sources with babel --- .babelrc | 10 ++++++ .gitignore | 2 ++ bin/flow2avro | 28 +---------------- lib/commands.js | 42 ------------------------- lib/index.js | 17 ---------- package.json | 12 +++++-- src/cli.js | 25 +++++++++++++++ {lib => src}/collector.js | 34 +++++++++----------- src/commands.js | 38 ++++++++++++++++++++++ {lib => src}/extractors.js | 21 +++++-------- {lib => src}/globals.js | 4 +-- src/index.js | 14 +++++++++ {lib => src}/list.js | 18 +++++------ {lib => src}/module.js | 11 ++----- {lib => src}/parser.js | 8 ++--- {lib => src}/scope.js | 26 +++++++-------- {lib => src}/utils.js | 11 ++----- tests/{do => run.js} | 14 +++------ tests/{ => samples}/arrays.js | 0 tests/{ => samples}/arrays.json | 0 tests/{ => samples}/disorder.js | 0 tests/{ => samples}/disorder.json | 0 tests/{ => samples}/empty.js | 0 tests/{ => samples}/empty.json | 0 tests/{ => samples}/enums.js | 0 tests/{ => samples}/enums.json | 0 tests/{ => samples}/externals.js | 0 tests/{ => samples}/externals.json | 0 tests/{ => samples}/externals/first.js | 0 tests/{ => samples}/externals/second.js | 0 tests/{ => samples}/generics.js | 0 tests/{ => samples}/generics.json | 0 tests/{ => samples}/inheritance.js | 0 tests/{ => samples}/inheritance.json | 0 tests/{ => samples}/intersections.js | 0 tests/{ => samples}/intersections.json | 0 tests/{ => samples}/maps.js | 0 tests/{ => samples}/maps.json | 0 tests/{ => samples}/pragmas.js | 0 tests/{ => samples}/pragmas.json | 0 tests/{ => samples}/primitives.js | 0 tests/{ => samples}/primitives.json | 0 tests/{ => samples}/references.js | 0 tests/{ => samples}/references.json | 0 tests/{ => samples}/scopes.js | 0 tests/{ => samples}/scopes.json | 0 tests/{ => samples}/shadowing.js | 0 tests/{ => samples}/shadowing.json | 0 tests/{ => samples}/skipFunctions.js | 0 tests/{ => samples}/skipFunctions.json | 0 tests/{ => samples}/typeInMethod.js | 0 tests/{ => samples}/typeInMethod.json | 0 tests/{ => samples}/unions.js | 0 tests/{ => samples}/unions.json | 0 tests/{ => samples}/unionsAndEnums.js | 0 tests/{ => samples}/unionsAndEnums.json | 0 tests/{ => samples}/unused.js | 0 tests/{ => samples}/unused.json | 0 tests/{ => samples}/valueAsType.js | 0 tests/{ => samples}/valueAsType.json | 0 60 files changed, 152 insertions(+), 183 deletions(-) create mode 100644 .babelrc delete mode 100644 lib/commands.js delete mode 100644 lib/index.js create mode 100644 src/cli.js rename {lib => src}/collector.js (93%) create mode 100644 src/commands.js rename {lib => src}/extractors.js (97%) rename {lib => src}/globals.js (71%) create mode 100644 src/index.js rename {lib => src}/list.js (69%) rename {lib => src}/module.js (86%) rename {lib => src}/parser.js (80%) rename {lib => src}/scope.js (88%) rename {lib => src}/utils.js (63%) rename tests/{do => run.js} (79%) mode change 100755 => 100644 rename tests/{ => samples}/arrays.js (100%) rename tests/{ => samples}/arrays.json (100%) rename tests/{ => samples}/disorder.js (100%) rename tests/{ => samples}/disorder.json (100%) rename tests/{ => samples}/empty.js (100%) rename tests/{ => samples}/empty.json (100%) rename tests/{ => samples}/enums.js (100%) rename tests/{ => samples}/enums.json (100%) rename tests/{ => samples}/externals.js (100%) rename tests/{ => samples}/externals.json (100%) rename tests/{ => samples}/externals/first.js (100%) rename tests/{ => samples}/externals/second.js (100%) rename tests/{ => samples}/generics.js (100%) rename tests/{ => samples}/generics.json (100%) rename tests/{ => samples}/inheritance.js (100%) rename tests/{ => samples}/inheritance.json (100%) rename tests/{ => samples}/intersections.js (100%) rename tests/{ => samples}/intersections.json (100%) rename tests/{ => samples}/maps.js (100%) rename tests/{ => samples}/maps.json (100%) rename tests/{ => samples}/pragmas.js (100%) rename tests/{ => samples}/pragmas.json (100%) rename tests/{ => samples}/primitives.js (100%) rename tests/{ => samples}/primitives.json (100%) rename tests/{ => samples}/references.js (100%) rename tests/{ => samples}/references.json (100%) rename tests/{ => samples}/scopes.js (100%) rename tests/{ => samples}/scopes.json (100%) rename tests/{ => samples}/shadowing.js (100%) rename tests/{ => samples}/shadowing.json (100%) rename tests/{ => samples}/skipFunctions.js (100%) rename tests/{ => samples}/skipFunctions.json (100%) rename tests/{ => samples}/typeInMethod.js (100%) rename tests/{ => samples}/typeInMethod.json (100%) rename tests/{ => samples}/unions.js (100%) rename tests/{ => samples}/unions.json (100%) rename tests/{ => samples}/unionsAndEnums.js (100%) rename tests/{ => samples}/unionsAndEnums.json (100%) rename tests/{ => samples}/unused.js (100%) rename tests/{ => samples}/unused.json (100%) rename tests/{ => samples}/valueAsType.js (100%) rename tests/{ => samples}/valueAsType.json (100%) diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..d9e1b62 --- /dev/null +++ b/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": [ + ["@babel/env", { + "targets": { + "node": "6.10" + }, + "loose": true + }] + ] +} diff --git a/.gitignore b/.gitignore index c846622..60826dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +lib/ node_modules/ .nyc_output/ coverage/ npm-debug.log +package-lock.json diff --git a/bin/flow2avro b/bin/flow2avro index dfc1f8f..d2316ff 100755 --- a/bin/flow2avro +++ b/bin/flow2avro @@ -1,29 +1,3 @@ #!/usr/bin/env node -'use strict'; - -const fs = require('fs'); - -const stringify = require('json-stringify-pretty-compact'); -const argv = require('optimist') - .usage('Usage: $0 ...') - .argv; - -const collect = require('..'); - -argv._.forEach(run); - -function run(path) { - if (path === '-') { - path = '/dev/stdin'; - } - - try { - const {schemas} = collect(path); - - console.log(stringify(schemas, {maxLength: 100})); - } catch (ex) { - console.error(ex.message); - console.error(ex.stack); - } -} +require('../lib/cli'); diff --git a/lib/commands.js b/lib/commands.js deleted file mode 100644 index 1994123..0000000 --- a/lib/commands.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -class Command { - static declare(name, node, params) { - return new Command('declare', [name, node, params]); - } - - static define(schema, declared = true) { - return new Command('define', [schema, declared]); - } - - static external(external) { - return new Command('external', external); - } - - static provide(name, reference = name) { - return new Command('provide', [name, reference]); - } - - static query(name, params = null) { - return new Command('query', [name, params]); - } - - static enter() { - return new Command('enter'); - } - - static exit() { - return new Command('exit'); - } - - static namespace() { - return new Command('namespace'); - } - - constructor(name, data) { - this.name = name; - this.data = data; - } -} - -module.exports = Command; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 5723b8e..0000000 --- a/lib/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -const Parser = require('./parser'); -const Collector = require('./collector'); - -function collect(path) { - const parser = new Parser; - const collector = new Collector(parser); - - collector.collect(path); - - return collector; -} - -module.exports = collect; -module.exports.Parser = Parser; -module.exports.Collector = Collector; diff --git a/package.json b/package.json index be7673f..c17722e 100644 --- a/package.json +++ b/package.json @@ -19,20 +19,26 @@ ], "main": "lib/index.js", "bin": { - "babylon": "./bin/babylon.js" + "flow2avro": "./bin/flow2avro" }, "dependencies": { - "babylon": "^6.18.0", + "babylon": "^7.0.0-beta.32", "json-stringify-pretty-compact": "^1.0.4", "optimist": "^0.6.1", "resolve": "^1.5.0" }, "devDependencies": { + "@babel/cli": "^7.0.0-beta.32", + "@babel/core": "^7.0.0-beta.32", + "@babel/preset-env": "^7.0.0-beta.32", + "@babel/register": "^7.0.0-beta.32", "jasmine": "^2.8.0", "mocha": "^4.0.1", "nyc": "^11.3.0" }, "scripts": { - "test": "nyc mocha tests/do" + "prepare": "npm run build", + "build": "babel src/ -d lib/", + "test": "nyc mocha --require @babel/register tests/run.js" } } diff --git a/src/cli.js b/src/cli.js new file mode 100644 index 0000000..5c3855f --- /dev/null +++ b/src/cli.js @@ -0,0 +1,25 @@ +import stringify from 'json-stringify-pretty-compact'; +import * as optimist from 'optimist'; + +import collect from '.'; + +const argv = optimist + .usage('Usage: $0 ...') + .argv; + +argv._.forEach(run); + +function run(path) { + if (path === '-') { + path = '/dev/stdin'; + } + + try { + const {schemas} = collect(path); + + console.log(stringify(schemas, {maxLength: 100})); + } catch (ex) { + console.error(ex.message); + console.error(ex.stack); + } +} diff --git a/lib/collector.js b/src/collector.js similarity index 93% rename from lib/collector.js rename to src/collector.js index ab2a013..b89a5c9 100644 --- a/lib/collector.js +++ b/src/collector.js @@ -1,18 +1,16 @@ -'use strict'; +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as pathlib from 'path'; -const assert = require('assert'); -const fs = require('fs'); -const pathlib = require('path'); +import globals from './globals'; +import * as extractors from './extractors'; +import Command from './commands'; +import Module from './module'; +import Scope from './scope'; +import CircularList from './list'; +import {isNode} from './utils'; -const globals = require('./globals'); -const extractors = require('./extractors'); -const Command = require('./commands'); -const Module = require('./module'); -const Scope = require('./scope'); -const CircularList = require('./list'); -const {isNode} = require('./utils'); - -class Collector { +export default class Collector { constructor(parser, root = '.') { this.root = root; this.parser = parser; @@ -130,7 +128,7 @@ class Collector { return value; } - assert(value); + assert.ok(value); if (value instanceof Command) { switch (value.name) { @@ -180,7 +178,7 @@ class Collector { break; case 'exit': - assert(scope.parent); + assert.ok(scope.parent); scope = scope.parent; break; @@ -196,7 +194,7 @@ class Collector { result.push(yield* this._collect(group, val, scope, params)); } } else { - assert(isNode(value)); + assert.ok(isNode(value)); result = yield* this._collect(group, value, scope, params); } } @@ -232,7 +230,7 @@ class Collector { } // TODO: reexports. - assert(result.type === 'declaration' || result.type === 'template'); + assert.ok(result.type === 'declaration' || result.type === 'template'); scope = result.scope; name = result.name; @@ -329,5 +327,3 @@ function generateGenericName(base, params) { return name; } - -module.exports = Collector; diff --git a/src/commands.js b/src/commands.js new file mode 100644 index 0000000..0774a49 --- /dev/null +++ b/src/commands.js @@ -0,0 +1,38 @@ +export default class Command { + constructor(name, data) { + this.name = name; + this.data = data; + } +} + +export function declare(name, node, params) { + return new Command('declare', [name, node, params]); +} + +export function define(schema, declared = true) { + return new Command('define', [schema, declared]); +} + +export function external(external) { + return new Command('external', external); +} + +export function provide(name, reference = name) { + return new Command('provide', [name, reference]); +} + +export function query(name, params = null) { + return new Command('query', [name, params]); +} + +export function enter() { + return new Command('enter'); +} + +export function exit() { + return new Command('exit'); +} + +export function namespace() { + return new Command('namespace'); +} diff --git a/lib/extractors.js b/src/extractors.js similarity index 97% rename from lib/extractors.js rename to src/extractors.js index bd089d3..304fb8c 100644 --- a/lib/extractors.js +++ b/src/extractors.js @@ -1,11 +1,9 @@ -'use strict'; +import * as assert from 'assert'; -const assert = require('assert'); +import {declare, define, external, provide, query, enter, exit, namespace} from './commands'; +import {partition, isNode} from './utils'; -const {declare, define, external, provide, query, enter, exit, namespace} = require('./commands'); -const {partition, isNode} = require('./utils'); - -const definition = { +export const definition = { entries: [ 'TypeAlias', 'InterfaceDeclaration', @@ -245,7 +243,7 @@ const definition = { }, }; -const declaration = { +export const declaration = { entries: [ // Blocks. 'Program', @@ -533,7 +531,7 @@ function extractPragma(text) { const pair = parsePragma(pragma); - assert(pair); + assert.ok(pair); const [type, arg] = pair; @@ -572,7 +570,7 @@ function unwrapEnumSymbol(node) { } function makeFullname(schema) { - assert(schema.namespace); + assert.ok(schema.namespace); return `${schema.namespace}.${schema.name}`; } @@ -614,8 +612,3 @@ function mergeSchemas(schemas) { function is(type) { return node => Boolean(node) && node.type === type; } - -module.exports = { - definition, - declaration, -}; diff --git a/lib/globals.js b/src/globals.js similarity index 71% rename from lib/globals.js rename to src/globals.js index ddfa2f9..857924f 100644 --- a/lib/globals.js +++ b/src/globals.js @@ -1,6 +1,4 @@ -'use strict'; - -module.exports = [ +export default [ { name: 'Buffer', type: 'bytes', diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..e7245ad --- /dev/null +++ b/src/index.js @@ -0,0 +1,14 @@ +import Parser from './parser'; +import Collector from './collector'; + +// @see babel#6805. +//export {Parser, Collector}; + +export default function collect(path) { + const parser = new Parser; + const collector = new Collector(parser); + + collector.collect(path); + + return collector; +} diff --git a/lib/list.js b/src/list.js similarity index 69% rename from lib/list.js rename to src/list.js index 1e98673..9b3dda8 100644 --- a/lib/list.js +++ b/src/list.js @@ -1,8 +1,6 @@ -'use strict'; +import * as assert from 'assert'; -const assert = require('assert'); - -class CircularList { +export default class CircularList { constructor() { this.mark = Symbol(); this.prev = null; @@ -14,25 +12,25 @@ class CircularList { } add(entry) { - assert(!entry[this.mark]); + assert.ok(!entry[this.mark]); if (this.prev) { - assert(this.walk); + assert.ok(this.walk); this.prev = this.prev[this.mark] = entry; } else { - assert(!this.walk); + assert.ok(!this.walk); this.walk = this.prev = entry; } entry[this.mark] = this.walk; - assert(!this.prev || this.prev[this.mark] === this.walk); + assert.ok(!this.prev || this.prev[this.mark] === this.walk); } remove() { - assert(this.walk); + assert.ok(this.walk); const removed = this.walk; @@ -47,5 +45,3 @@ class CircularList { return removed; } } - -module.exports = CircularList; diff --git a/lib/module.js b/src/module.js similarity index 86% rename from lib/module.js rename to src/module.js index 858fc23..9cb02f9 100644 --- a/lib/module.js +++ b/src/module.js @@ -1,10 +1,7 @@ -'use strict'; +import * as pathlib from 'path'; +import * as resolve from 'resolve'; -const pathlib = require('path'); - -const resolve = require('resolve'); - -class Module { +export default class Module { constructor(path, namespace) { this.path = path; this.namespace = namespace; @@ -45,5 +42,3 @@ class Module { return this._exports.values(); } } - -module.exports = Module; diff --git a/lib/parser.js b/src/parser.js similarity index 80% rename from lib/parser.js rename to src/parser.js index 97c849c..eea0ef1 100644 --- a/lib/parser.js +++ b/src/parser.js @@ -1,8 +1,6 @@ -'use strict'; +import * as babylon from 'babylon'; -const babylon = require('babylon'); - -class Parser { +export default class Parser { parse(code) { // This parse configuration is intended to be as permissive as possible. return babylon.parse(code, { @@ -14,5 +12,3 @@ class Parser { }); } } - -module.exports = Parser; diff --git a/lib/scope.js b/src/scope.js similarity index 88% rename from lib/scope.js rename to src/scope.js index 76a4a2a..0f85bbb 100644 --- a/lib/scope.js +++ b/src/scope.js @@ -1,8 +1,6 @@ -'use strict'; +import * as assert from 'assert'; -const assert = require('assert'); - -class Scope { +export default class Scope { static global(schemas) { const global = new Scope(null, null); @@ -21,7 +19,7 @@ class Scope { } get namespace() { - assert(this.module); + assert.ok(this.module); let namespace = this.module.namespace; @@ -38,7 +36,7 @@ class Scope { } addDeclaration(name, node, params) { - assert(!this.entries.has(name)); + assert.ok(!this.entries.has(name)); const isTemplate = Boolean(params); @@ -60,7 +58,7 @@ class Scope { addInstance(name, schema, params) { const template = this.entries.get(name); - assert(template); + assert.ok(template); assert.equal(template.type, 'template'); template.instances.push({params, schema}); @@ -70,10 +68,10 @@ class Scope { const decl = this.entries.get(schema.name); if (declared) { - assert(decl); + assert.ok(decl); assert.equal(decl.type, 'declaration'); } else { - assert(!decl); + assert.ok(!decl); } this.entries.set(schema.name, { @@ -84,7 +82,7 @@ class Scope { } addImport(info) { - assert(!this.entries.has(info.local)); + assert.ok(!this.entries.has(info.local)); this.entries.set(info.local, { type: 'external', @@ -94,13 +92,13 @@ class Scope { } addExport(name, reference) { - assert(this.module); + assert.ok(this.module); this.module.addExport(name, this, reference); } resolve(path) { - assert(this.module); + assert.ok(this.module); return this.module.resolve(path); } @@ -109,7 +107,7 @@ class Scope { const entry = this.entries.get(name); if (entry && entry.type === 'template') { - assert(params); + assert.ok(params); const augmented = entry.params.map((p, i) => params[i] || p.default); const schema = findInstance(entry, augmented); @@ -149,5 +147,3 @@ function findInstance(template, queried) { return null; } - -module.exports = Scope; diff --git a/lib/utils.js b/src/utils.js similarity index 63% rename from lib/utils.js rename to src/utils.js index 04260b1..ac301f1 100644 --- a/lib/utils.js +++ b/src/utils.js @@ -1,6 +1,4 @@ -'use strict'; - -function partition(iter, predicate) { +export function partition(iter, predicate) { const left = []; const right = []; @@ -11,11 +9,6 @@ function partition(iter, predicate) { return [left, right]; } -function isNode(it) { +export function isNode(it) { return it && typeof it === 'object' && it.type; } - -module.exports = { - partition, - isNode, -}; diff --git a/tests/do b/tests/run.js old mode 100755 new mode 100644 similarity index 79% rename from tests/do rename to tests/run.js index 65843d5..3821765 --- a/tests/do +++ b/tests/run.js @@ -1,12 +1,8 @@ -#!/usr/bin/env node +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; -'use strict'; - -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); - -const collect = require('..'); +import collect from '../src'; function run(title) { let actual, expected; @@ -27,7 +23,7 @@ function run(title) { } function main() { - process.chdir(__dirname); + process.chdir(path.join(__dirname, 'samples')); fs.readdirSync('.') .filter(name => path.extname(name) === '.js') diff --git a/tests/arrays.js b/tests/samples/arrays.js similarity index 100% rename from tests/arrays.js rename to tests/samples/arrays.js diff --git a/tests/arrays.json b/tests/samples/arrays.json similarity index 100% rename from tests/arrays.json rename to tests/samples/arrays.json diff --git a/tests/disorder.js b/tests/samples/disorder.js similarity index 100% rename from tests/disorder.js rename to tests/samples/disorder.js diff --git a/tests/disorder.json b/tests/samples/disorder.json similarity index 100% rename from tests/disorder.json rename to tests/samples/disorder.json diff --git a/tests/empty.js b/tests/samples/empty.js similarity index 100% rename from tests/empty.js rename to tests/samples/empty.js diff --git a/tests/empty.json b/tests/samples/empty.json similarity index 100% rename from tests/empty.json rename to tests/samples/empty.json diff --git a/tests/enums.js b/tests/samples/enums.js similarity index 100% rename from tests/enums.js rename to tests/samples/enums.js diff --git a/tests/enums.json b/tests/samples/enums.json similarity index 100% rename from tests/enums.json rename to tests/samples/enums.json diff --git a/tests/externals.js b/tests/samples/externals.js similarity index 100% rename from tests/externals.js rename to tests/samples/externals.js diff --git a/tests/externals.json b/tests/samples/externals.json similarity index 100% rename from tests/externals.json rename to tests/samples/externals.json diff --git a/tests/externals/first.js b/tests/samples/externals/first.js similarity index 100% rename from tests/externals/first.js rename to tests/samples/externals/first.js diff --git a/tests/externals/second.js b/tests/samples/externals/second.js similarity index 100% rename from tests/externals/second.js rename to tests/samples/externals/second.js diff --git a/tests/generics.js b/tests/samples/generics.js similarity index 100% rename from tests/generics.js rename to tests/samples/generics.js diff --git a/tests/generics.json b/tests/samples/generics.json similarity index 100% rename from tests/generics.json rename to tests/samples/generics.json diff --git a/tests/inheritance.js b/tests/samples/inheritance.js similarity index 100% rename from tests/inheritance.js rename to tests/samples/inheritance.js diff --git a/tests/inheritance.json b/tests/samples/inheritance.json similarity index 100% rename from tests/inheritance.json rename to tests/samples/inheritance.json diff --git a/tests/intersections.js b/tests/samples/intersections.js similarity index 100% rename from tests/intersections.js rename to tests/samples/intersections.js diff --git a/tests/intersections.json b/tests/samples/intersections.json similarity index 100% rename from tests/intersections.json rename to tests/samples/intersections.json diff --git a/tests/maps.js b/tests/samples/maps.js similarity index 100% rename from tests/maps.js rename to tests/samples/maps.js diff --git a/tests/maps.json b/tests/samples/maps.json similarity index 100% rename from tests/maps.json rename to tests/samples/maps.json diff --git a/tests/pragmas.js b/tests/samples/pragmas.js similarity index 100% rename from tests/pragmas.js rename to tests/samples/pragmas.js diff --git a/tests/pragmas.json b/tests/samples/pragmas.json similarity index 100% rename from tests/pragmas.json rename to tests/samples/pragmas.json diff --git a/tests/primitives.js b/tests/samples/primitives.js similarity index 100% rename from tests/primitives.js rename to tests/samples/primitives.js diff --git a/tests/primitives.json b/tests/samples/primitives.json similarity index 100% rename from tests/primitives.json rename to tests/samples/primitives.json diff --git a/tests/references.js b/tests/samples/references.js similarity index 100% rename from tests/references.js rename to tests/samples/references.js diff --git a/tests/references.json b/tests/samples/references.json similarity index 100% rename from tests/references.json rename to tests/samples/references.json diff --git a/tests/scopes.js b/tests/samples/scopes.js similarity index 100% rename from tests/scopes.js rename to tests/samples/scopes.js diff --git a/tests/scopes.json b/tests/samples/scopes.json similarity index 100% rename from tests/scopes.json rename to tests/samples/scopes.json diff --git a/tests/shadowing.js b/tests/samples/shadowing.js similarity index 100% rename from tests/shadowing.js rename to tests/samples/shadowing.js diff --git a/tests/shadowing.json b/tests/samples/shadowing.json similarity index 100% rename from tests/shadowing.json rename to tests/samples/shadowing.json diff --git a/tests/skipFunctions.js b/tests/samples/skipFunctions.js similarity index 100% rename from tests/skipFunctions.js rename to tests/samples/skipFunctions.js diff --git a/tests/skipFunctions.json b/tests/samples/skipFunctions.json similarity index 100% rename from tests/skipFunctions.json rename to tests/samples/skipFunctions.json diff --git a/tests/typeInMethod.js b/tests/samples/typeInMethod.js similarity index 100% rename from tests/typeInMethod.js rename to tests/samples/typeInMethod.js diff --git a/tests/typeInMethod.json b/tests/samples/typeInMethod.json similarity index 100% rename from tests/typeInMethod.json rename to tests/samples/typeInMethod.json diff --git a/tests/unions.js b/tests/samples/unions.js similarity index 100% rename from tests/unions.js rename to tests/samples/unions.js diff --git a/tests/unions.json b/tests/samples/unions.json similarity index 100% rename from tests/unions.json rename to tests/samples/unions.json diff --git a/tests/unionsAndEnums.js b/tests/samples/unionsAndEnums.js similarity index 100% rename from tests/unionsAndEnums.js rename to tests/samples/unionsAndEnums.js diff --git a/tests/unionsAndEnums.json b/tests/samples/unionsAndEnums.json similarity index 100% rename from tests/unionsAndEnums.json rename to tests/samples/unionsAndEnums.json diff --git a/tests/unused.js b/tests/samples/unused.js similarity index 100% rename from tests/unused.js rename to tests/samples/unused.js diff --git a/tests/unused.json b/tests/samples/unused.json similarity index 100% rename from tests/unused.json rename to tests/samples/unused.json diff --git a/tests/valueAsType.js b/tests/samples/valueAsType.js similarity index 100% rename from tests/valueAsType.js rename to tests/samples/valueAsType.js diff --git a/tests/valueAsType.json b/tests/samples/valueAsType.json similarity index 100% rename from tests/valueAsType.json rename to tests/samples/valueAsType.json